TheDarkBlade Posted December 25, 2015 Share Posted December 25, 2015 function vehspawner( thePlayer ,commandName, ID) local x, y ,z = getElementPosition ( player ) local team = getPlayerTeam ( thePlayer ) if (team == Staff )then succes = createVehicle ( ID, x+2 , y+2 , z ) if (succes) then outputChatBox("Am spawnat masina", source) else outputChatBox("Am esuat", source) end else outputChatBox("Nu esti Staff", source) end end addCommandHandler("sv",vehspawner) my error "Bad argument @ getElementPossition [Expected element at argument 1 , got nill ] Link to comment
S3Nn4oXx Posted December 25, 2015 Share Posted December 25, 2015 (edited) player is not defined, instead of you can use thePlayer because it's defined in your function . function vehspawner( thePlayer ,commandName, ID) local x, y ,z = getElementPosition ( thePlayer ) local team = getPlayerTeam ( thePlayer ) if (team == Staff )then succes = createVehicle ( ID, x+2 , y+2 , z ) if (succes) then outputChatBox("Am spawnat masina", source) else outputChatBox("Am esuat", source) end else outputChatBox("Nu esti Staff", source) end end addCommandHandler("sv",vehspawner) Edited December 25, 2015 by Guest Link to comment
Noki Posted December 25, 2015 Share Posted December 25, 2015 'player' is not defined. Use 'thePlayer' instead as that's what's defined in your function. Oh, and the team part won't work. You're checking a team element, but it looks to me you want to compare two strings instead. local team = getTeamName(getPlayerTeam(thePlayer)) if (team == "Staff") then 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