sckatchof Posted February 24, 2012 Share Posted February 24, 2012 hi guys i make a script when i type /criminal i became on the team this is my script criminalTeam = createTeam ("Criminal", 255, 0, 0) function joinTeam (source) local criminalTeam = getTeamFromName ("Criminal") if (criminalTeam) then setElementData( localPlayer, "Job", "Criminal", true ) setPlayerTeam (source, criminalTeam) setElementModel (source, 29) end end addCommandHandler ("criminal", joinTeam) Link to comment
Castillo Posted February 24, 2012 Share Posted February 24, 2012 criminalTeam = createTeam ("Criminal", 255, 0, 0) function joinTeam (thePlayer) setElementData( thePlayer, "Job", "Criminal", true ) setPlayerTeam (thePlayer, criminalTeam) setElementModel (thePlayer, 29) end addCommandHandler ("criminal", joinTeam) Link to comment
sckatchof Posted February 24, 2012 Author Share Posted February 24, 2012 criminalTeam = createTeam ("Criminal", 255, 0, 0) function joinTeam (thePlayer) setElementData( thePlayer, "Job", "Criminal", true ) setPlayerTeam (thePlayer, criminalTeam) setElementModel (thePlayer, 29) end addCommandHandler ("criminal", joinTeam) work Thank you snake for help Link to comment
sckatchof Posted February 24, 2012 Author Share Posted February 24, 2012 but in this dont work why ? Bad argument @'setElementData' staffTeam = createTeam ("Staff", 255, 255, 255) setTeamFriendlyFire (staffTeam, false) function joinTeam (source) local accName = getAccountName (getPlayerAccount (source)) if (isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) ) then if (staffTeam) then setPlayerTeam (source, staffTeam) setElementData( thePlayer, "Jobn", "Head Staff", true ) outputChatBox ( "You are now Staff.", 0,255, 0 ) end end end addCommandHandler ("staff", joinTeam) Link to comment
Castillo Posted February 24, 2012 Share Posted February 24, 2012 staffTeam = createTeam ("Staff", 255, 255, 255) setTeamFriendlyFire (staffTeam, false) function joinTeam (thePlayer) local accName = getAccountName (getPlayerAccount (thePlayer)) if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) ) then if (staffTeam) then setPlayerTeam (thePlayer, staffTeam) setElementData( thePlayer, "Occupation", "Head Staff", true ) outputChatBox ( "You are now Staff.", thePlayer, 0,255, 0 ) end end end addCommandHandler ("staff", joinTeam) Link to comment
sckatchof Posted February 24, 2012 Author Share Posted February 24, 2012 staffTeam = createTeam ("Staff", 255, 255, 255) setTeamFriendlyFire (staffTeam, false) function joinTeam (thePlayer) local accName = getAccountName (getPlayerAccount (thePlayer)) if ( isObjectInACLGroup ("user." .. accName, aclGetGroup("Admin")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("Moderator")) or isObjectInACLGroup ("user." .. accName, aclGetGroup ("SuperModerator")) ) then if (staffTeam) then setPlayerTeam (thePlayer, staffTeam) setElementData( thePlayer, "Occupation", "Head Staff", true ) outputChatBox ( "You are now Staff.", thePlayer, 0,255, 0 ) end end end addCommandHandler ("staff", joinTeam) thank you again snake Link to comment
Kenix Posted February 24, 2012 Share Posted February 24, 2012 So your code. outputChatBox ( "You are now Staff.", 0,255, 0 ) Correct outputChatBox ( "You are now Staff.", source, 0,255, 0 ) Because in server side 6 arguments , in client side 5 arguments. And you use not defiend variable thePlayer ( nil ). here setElementData( thePlayer, "Jobn", "Head Staff", true ) Correct setElementData( source, "Jobn", "Head Staff", true ) Because you add to arguments command handler function first argument 'source'. staffTeam = createTeam ( "Staff", 255, 255, 255 ) setTeamFriendlyFire ( staffTeam, false ) function joinTeam ( source ) local accName = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup ( "user." .. accName, aclGetGroup( "Admin" ) ) or isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "Moderator" ) ) or isObjectInACLGroup ( "user." .. accName, aclGetGroup ( "SuperModerator" ) ) then if staffTeam then setPlayerTeam ( source, staffTeam ) setElementData( source, "Occupation", "Head Staff", true ) outputChatBox ( "You are now Staff.", source, 0,255, 0 ) end end end addCommandHandler ( "staff", joinTeam ) Full correct code. I think you not read my post just copy paste Link to comment
sckatchof Posted February 25, 2012 Author Share Posted February 25, 2012 (edited) No i read it thank you kenix Edited February 25, 2012 by Guest 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