Rat32 Posted June 3, 2015 Share Posted June 3, 2015 Hello. function ballas(cmd, plr) veh = createVehicle(567, 2194.4052734375, -1382.0394287109, 24.62880897522, 0, 0, 90, "DB "..math.random(1,9)..math.random(1,9)..math.random(1,9)..math.random(1.9)) vehm = getElementModel(veh) plr = getLocalPlayer() setElementFrozen(veh, true) tim = getPlayerTeam(plr) teamname = getTeamName(tim) if teamname == getTeamFromName("BALLAS") then setVehicleColor(veh, 128, 0, 192) elseif teamname == getTeamFromName("GROVES") then setVehicleColor(veh, 64, 160, 16) elseif teamname == getTeamFromName("LATINOS") then setVehicleColor(veh, 0, 0, 0) end end addCommandHandler("tests", ballas) This script not changing of vehicle color, why? . Problem with getting team? THIS IS CLIENTSIDE SCRIPT Link to comment
ALw7sH Posted June 3, 2015 Share Posted June 3, 2015 You are compare string with element getTeamFromName return the team element getTeam name return the name name So it should be function ballas(cmd, plr) veh = createVehicle(567, 2194.4052734375, -1382.0394287109, 24.62880897522, 0, 0, 90, "DB "..math.random(1,9)..math.random(1,9)..math.random(1,9)..math.random(1.9)) vehm = getElementModel(veh) plr = getLocalPlayer() setElementFrozen(veh, true) tim = getPlayerTeam(plr) teamname = getTeamName(tim) if teamname == "BALLAS" then setVehicleColor(veh, 128, 0, 192) elseif teamname == "GROVES" then setVehicleColor(veh, 64, 160, 16) elseif teamname == "LATINOS" then setVehicleColor(veh, 0, 0, 0) end end addCommandHandler("tests", ballas) or function ballas(cmd, plr) veh = createVehicle(567, 2194.4052734375, -1382.0394287109, 24.62880897522, 0, 0, 90, "DB "..math.random(1,9)..math.random(1,9)..math.random(1,9)..math.random(1.9)) vehm = getElementModel(veh) plr = getLocalPlayer() setElementFrozen(veh, true) tim = getPlayerTeam(plr) if tim == getTeamFromName("BALLAS") then setVehicleColor(veh, 128, 0, 192) elseif tim == getTeamFromName("GROVES") then setVehicleColor(veh, 64, 160, 16) elseif tim == getTeamFromName("LATINOS") then setVehicleColor(veh, 0, 0, 0) end end addCommandHandler("tests", ballas) Link to comment
Dealman Posted June 3, 2015 Share Posted June 3, 2015 Also the last math.random has a period instead of a comma, resulting in a float value rather than an integer. Link to comment
Rat32 Posted June 4, 2015 Author Share Posted June 4, 2015 @ALw7SH - not working too. @Dealman - but working , this is no problem. Link to comment
TAPL Posted June 4, 2015 Share Posted June 4, 2015 Try with a timer: setTimer(setVehicleColor, 50, 1, veh, 128, 0, 192) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now