Tarek632 Posted May 1, 2013 Posted May 1, 2013 Is There A script That makes you a Criminal when you type /criminal Thank You.
iPrestege Posted May 1, 2013 Posted May 1, 2013 createTeam addCommandHandler player element setPlayerTeam
Tarek632 Posted May 1, 2013 Author Posted May 1, 2013 So i do createTeam "Criminal" addCommandHandler (criminal) player element setPlayerTeam
PaiN^ Posted May 1, 2013 Posted May 1, 2013 No, That makes no sens ! You should learn more about Lua scripting, See these topics : viewtopic.php?f=91&t=39678 viewtopic.php?f=148&t=40809
iPrestege Posted May 1, 2013 Posted May 1, 2013 See this code it's server side script learn from it : local Criminal = createTeam ( "Criminal" , 155 , 0 ,0 ) -- Create a New Team With 'Criminal' Name addCommandHandler ( "Criminal" , -- Add 'Criminal' Command Handler function ( player ) -- Create a New Function . if ( isElement ( player ) ) then -- Check The Player Element. if ( getTeamName(getPlayerTeam(player)) == ( "Criminal" ) ) then -- Check If The Player Already On The 'Criminal' Team . outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0) -- Output On The Chat For The Player . return end -- Return and Stop The Function . setPlayerTeam ( player , Criminal ) -- Here If The Player Wasn't In The 'Team' Then Set It Into The Team! outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) -- Output On The Chat For The Player . end -- Close end -- Close )-- Close
Tarek632 Posted May 1, 2013 Author Posted May 1, 2013 Ok I made the script but it isnt showing on the resorces i put a meta inf is there a proper meta.inf i can put?
Tarek632 Posted May 1, 2013 Author Posted May 1, 2013 can someone make me an meta.xml for that script
PaiN^ Posted May 1, 2013 Posted May 1, 2013 meta.xml file is the easiset thing about MTA-Lua scripting , Try after reading this : wiki/Meta.xml
WASSIm. Posted May 1, 2013 Posted May 1, 2013 change addCommandHandler ( "Criminal" , to addCommandHandler ( "criminal" ,
iPrestege Posted May 1, 2013 Posted May 1, 2013 change addCommandHandler ( "Criminal" , to addCommandHandler ( "criminal" , Make no sense!
WASSIm. Posted May 1, 2013 Posted May 1, 2013 change addCommandHandler ( "Criminal" , to addCommandHandler ( "criminal" , Make no sense! if command (Criminal) and if i try criminal not working -___- some player dont know that
PaiN^ Posted May 2, 2013 Posted May 2, 2013 if command (Criminal) and if i try criminal not working -___-some player dont know that True, But i think it's from the meta.xml . Anyway, We won't know until we get an answer from Tarek632 .
adithegman Posted May 2, 2013 Posted May 2, 2013 i made another one from scratch so create a new lua file named "server" without quotes witch containes this code: local Criminal = createTeam ( "Criminal", 155, 0, 0 ) function putPlayerInTeam ( player ) if ( isElement ( player ) ) then if ( getPlayerTeam ( player ) == getTeamFromName ( "Criminal" )) then outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0) return end setPlayerTeam ( player , Criminal ) outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) end end addCommandHandler ( "criminal", putPlayerInTeam ) and don't forget to create "meta.xml" file witch contains: <meta> <script src="server.lua" type="server" /> </meta> note: mta.xml must be in the same folder with server.lua hope it helps
PaiN^ Posted May 2, 2013 Posted May 2, 2013 addCommandHandler ( "criminal", function ( player ) if getPlayerTeam ( player ) == getTeamFromName ( "Criminal" ) then outputChatBox("* You Are Already On The 'Criminal' Team!",player,255,0,0) else setPlayerTeam ( player , Criminal ) outputChatBox("* You Have Been Joined Into The 'Criminal' Team! ",player,155,0,0) end end )
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