28WL Posted February 9, 2014 Posted February 9, 2014 Please, help me. If I write that "/extermination" command ---> only I will see it, other players not? Client script --- Player, who is one the groups, write a command --- only he will see? Server script --- If somebody one of the groups member will write a command, then all players will see these messages? And this is client script, nobody will see it, just who wrote it? addCommandHandler ( "extermination", function ( MissionExtermination ) if isAccountInGroup ( { "Exterminator" "Soldier" }, getAccountName ( getPlayerAccount ( MissionExtermination ) ) ) then outputChatBox("^ ATTENTION WARNING!", MissionExtermination, 255, 0, 0, true) outputChatBox("^ Started mission: Extermination.", MissionExtermination, 255, 0, 0, true) else outputChatBox ("^ You have no acces to that command.", MissionExtermination ) end end ) function isAccountInGroup ( groups, account ) local theGroup = false for _, group in ipairs ( groups ) do if isObjectInACLGroup ( "user.".. account, aclGetGroup ( group ) ) then theGroup = group break end end return theGroup end So I need to create (add) server script? addEvent ( "extermination", true ) addEventHandler ( "MissionExtermination", root, function ( MissionExterminationStart ) outputChatBox("^ ATTENTION WARNING!", MissionExterminationStart, 255, 0, 0, true) outputChatBox("^ Started mission: Extermination.", MissionExterminationStart, 255, 0, 0, true) end )
ixjf Posted February 9, 2014 Posted February 9, 2014 How is this even possible. This section's name clearly says that it is for NON-HELP MTA discussions.
xDrul Posted February 9, 2014 Posted February 9, 2014 Use triggerServerEvent So instead of the outputChatBox @ the client side, you use addCommandHandler ( "extermination", function ( MissionExtermination ) if isAccountInGroup ( { "Exterminator" "Soldier" }, getAccountName ( getPlayerAccount ( MissionExtermination ) ) ) then triggerServerEvent("extermination", getRootElement()) else outputChatBox ("^ You have no acces to that command.", MissionExtermination ) end end ) Server side fixed; function output() outputChatBox("^ ATTENTION WARNING!", 255, 0, 0) outputChatBox("^ Started mission: Extermination.", 255, 0, 0) end addEvent("extermination", true) addEventHandler("extermination", getRootElement(), output)
28WL Posted February 10, 2014 Author Posted February 10, 2014 0% working. I'll use Castillo cooked Sounds Player and also I'll modify to this resource.
Moderators IIYAMA Posted February 12, 2014 Moderators Posted February 12, 2014 Is incorrect. addCommandHandler doesn't return a player at client side. That should be the localPlayer. (localPlayer doesn't have to be defined with the parameters, it is at every place at clientside reach able) triggerServerEvent("extermination", localPlayer) triggerServerEvent("extermination", localPlayer) is source At serverside the player is: source -- this is the element of the event handler.(when this is the player) or client (source doesn't have to be defined with the parameters, nor as client) @xDrul You can't just skip an argument of outputChatBox ...... ( it is serverside, not client side)
Sasu Posted February 12, 2014 Posted February 12, 2014 You missed a comma on line 3 in the table at argument 1 of 'isAccountInGroup'.
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