Hey Leute ich hab einen Teamcolor Script!
Allerdings gibt es folgendes Problem: Die Autos nehen die Farbe nur manchmal an...
Wie kann ich die Normale Farbe immer auf Weiß stellen?
Lua
function vehiclepaint ( player, seat )
if ( seat == 0 and getPlayerTeam ( player ) ) then
local r,g,b = getTeamColor ( getPlayerTeam ( player ) )
setVehicleColor ( source, r, g, b, 0, 0, 0 )
end
end
addEventHandler ( "onVehicleEnter",root, vehiclepaint )
addEvent ( "onPlayerPickUpRacePickup", true )
addEventHandler ( "onPlayerPickUpRacePickup", root,
function ( pickupID, pickupType, vehicleModel )
if ( pickupType == "vehiclechange" and getPlayerTeam ( source ) ) then
local r, g, b = getTeamColor ( getPlayerTeam ( source ) )
setVehicleColor ( getPedOccupiedVehicle ( source ), r, g, b, 0, 0, 0 )
end
end
)
addCommandHandler("addteam",
function(source, cmd, clantag, color, ...)
local name = {...}
if not name[1] then
outputChatBox("syntax: "..cmd.." <clantag> <color> <name>", source)
return
end
local r,g,b = getColorFromString(color)
if not r then
outputChatBox(cmd..": invalid color code", source)
return
end
name = table.concat(name, ' ')
local config = xmlLoadFile("config.xml")
-- local config = getResourceConfig("config.xml")
local teamset, teamname
for name,settings in next,teams do
if settings.tag == clantag then
teamset, teamname = settings, name
break
end
end
if teamset then
local name_differs, color_differs
local c = teamset.color
local t = getTeamFromName(teamname)
if c[1] ~= r or c[2] ~= g or c[3] ~= b then
teamset.color = {r,g,b}
color_differs = true
if t then setTeamColor(t, r, g, b)end
end
if teamname ~= name then
name_differs = true
end
if color_differs or name_differs then
for k,child in next,xmlNodeGetChildren(config)do
if xmlNodeGetAttribute(child, "tag") == clantag then
if color_differs then
xmlNodeSetAttribute(child, "color", string.format("#%02X%02X%02X", r, g, b))
end
if name_differs then
xmlNodeSetAttribute(child, "name", name)
end
break
end
end
end
end
end
)
Alles anzeigen