Xeno Posted March 3, 2012 Share Posted March 3, 2012 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
Kenix Posted March 3, 2012 Share Posted March 3, 2012 1 argument is string not element I said you. Read this too viewtopic.php?f=91&t=40807 Link to comment
Xeno Posted March 3, 2012 Author Share Posted March 3, 2012 If it needs to be a string then, what do I put there? Link to comment
Kenix Posted March 3, 2012 Share Posted March 3, 2012 If it needs to be a string then, what do I put there? You need use player element. Link to comment
Xeno Posted March 3, 2012 Author Share Posted March 3, 2012 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
Kenix Posted March 3, 2012 Share Posted March 3, 2012 (edited) 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 March 3, 2012 by Guest Link to comment
Xeno Posted March 3, 2012 Author Share Posted March 3, 2012 Oh sorry, I didn't read the previous posts before. I thought you we're saying that they needed to be strings, let me test quickly.. Thanks. 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