Jump to content

setPlayerTeam


Recommended Posts

I have a slight issue, I get a bad argument for setPlayerTeam when the person does /criminal, another issue is who ever does /criminal the chat appears to everyone ^_^

(This is all server side)

On another script the team is created

local Criminals = createTeam ("Criminals",220,0,0) 

Here is a different script where /criminal is made but not working D:

function setCriminal () 
if not Criminals 
then 
    setPlayerTeam (source,Criminals) 
    outputChatBox ("You are now a Criminal!",source,255,0,0) 
else  
    outputChatBox ("You are already a Criminal!",source,255,0,0) 
end 
end 
addCommandHandler("criminal",setCriminal) 
  

Link to comment

How about this?

  
--/criminal 
function setCriminal () 
getPlayerTeam ( source ) = gotTeam 
if gotTeam == Criminals 
then 
    outputChatBox ("You are already a Criminal!",source,255,0,0) 
else  
    setPlayerTeam (source,getTeamFromName(tostring(Criminals))) 
    outputChatBox ("You are now a Criminal!",source,255,0,0) 
end 
end 
addCommandHandler("criminal",setCriminal) 
  

Link to comment

-- # Server Side 
function setCriminal ( player ) 
    if getPlayerTeam ( player ) == getTeamFromName ( "Criminals" ) then 
        outputChatBox ("You are already a Criminal!",player,255,0,0) return end 
        setPlayerTeam (player,getTeamFromName( "Criminals" ) ) 
        outputChatBox ("You are now a Criminal!",player,255,0,0) 
end 
addCommandHandler("criminal",setCriminal) 
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...