Jump to content

Checking team


Xeno

Recommended Posts

Hey guys, I'm trying to check teams for opening a GUI but it doesn't seem to work, please help me :3

function itsClicked ( player, button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
team = getPlayerTeam(player) 
staff = getTeamFromName("Staff") 
    if clickedElement and isElement( clickedElement ) and getElementType(clickedElement ) == "vehicle" and (team == staff) then 
element = clickedElement 
guiSetVisible(gui, true) 
else 
end 
end 
addEventHandler("onClientClick", root, itsClicked) 

I know i've done something wrong, but I don't know what.

Thanks

Xeno.

Link to comment

Ok, so I got this

function clicked ( player, button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement ) 
team = getPlayerTeam("player") 
staff = getTeamFromName("Staff") 
    if clickedElement and isElement( clickedElement ) and getElementType(clickedElement ) == "vehicle" and (team ==  
  
staff) then 
element = clickedElement 
guiSetVisible(gui, true) 
else 
end 
end 
addEventHandler("onClientClick", root, clicked) 

But I get no errors.

Link to comment

:/

Learn https://wiki.multitheftauto.com/wiki/Scr ... troduction

element player, not string.

In your situation, i think you need use localPlayer

Example, client side.

  
addCommandHandler( 'getTeam', 
    function( ) 
        local uTeam = getPlayerTeam( localPlayer ) 
        if uTeam then 
            outputChatBox( 'Your team: ' .. getTeamName( uTeam ) ) 
        else 
            outputChatBox 'Not in team ):' 
        end 
    end 
)    
  

Edited by Guest
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...