Jump to content

Script help


TheDarkBlade

Recommended Posts

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

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 by Guest
Link to comment

'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

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...