bartje01 Posted June 10, 2012 Share Posted June 10, 2012 Hey all. I was wondering how this works. I want that if you type: "strike", it'll check if you're in the strikeforce. I have this: function strike ( source ) if ( playerTeam(source) == "Strike Force")then else outputChatBox ( getPlayerName ( source ) .. " You're not in strike force" ) end addCommandHandler ( "strike", strike ) Well, it didn't work . Could someone explain me how it does work? Link to comment
Guest Guest4401 Posted June 10, 2012 Share Posted June 10, 2012 function strike(source) if getPlayerTeam(source) and getPlayerTeam(source) == getTeamFromName("Strike Force") then -- You must check if the player is in a team & also check if the player's team is Strike Force. You must compare either team elements or team names. outputChatBox("You are in strike force team",source) else outputChatBox("You are not in strike force team",source) end -- You had forgotten an end end addCommandHandler ("strike",strike) Link to comment
X-SHADOW Posted June 10, 2012 Share Posted June 10, 2012 (edited) why did you use getPlayerTeam 2 times ? Edited June 10, 2012 by Guest Link to comment
X-SHADOW Posted June 10, 2012 Share Posted June 10, 2012 and how can i make it defined ? Link to comment
Guest Guest4401 Posted June 10, 2012 Share Posted June 10, 2012 (edited) and how can i make it defined ? First parametre of addCommandHandler is the player element. Take a look carefully at the serverside syntax & examples. https://wiki.multitheftauto.com/wiki/AddCommandHandler addCommandHandler("test", function() --source is nil end ) addCommandHandler("test", function(source) --source is player element end ) addCommandHandler("test", function(blabla) --blabla is player element end ) Edited June 10, 2012 by Guest4401 Link to comment
X-SHADOW Posted June 10, 2012 Share Posted June 10, 2012 Oh You Mean i make it for example like this ? ( uPlayer ) or ( tPlayer ) or ( god Damn Player ) ? 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