Jump to content

Easy error...


Rat32

Recommended Posts

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? :P. Problem with getting team?

THIS IS CLIENTSIDE SCRIPT :!::!::!::!::!::!:

Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...