joao2235 Posted June 21, 2019 Share Posted June 21, 2019 local animEnable = {} local syncPlayers = {} addCommandHandler("continencia", function(player) if ( getElementType ( player ) == "anim" ) then if ( not isObjectInACLGroup ( "user." .. getAccountName ( getPlayerAccount ( player ) ), aclGetGroup ( "VIP" ) ) ) then if (not animEnable[player]) then animEnable[player] = true triggerClientEvent(syncPlayers, "anim", player, true) outputChatBox("*Continência #00FF00ativada", player, 255, 255, 255, true) else animEnable[player] = false triggerClientEvent(syncPlayers, "anim", player, false) outputChatBox("*Continência #FF0000desativada", player, 255, 255, 255, true) end end ) addEvent("onClientSync", true ) addEventHandler("onClientSync", resourceRoot, function() table.insert(syncPlayers, client) for player, enable in ipairs(animEnable) do if (enable) then triggerClientEvent(client, "anim", player, true) end end end ) addEventHandler("onPlayerQuit", root, function() for i, player in ipairs(syncPlayers) do if source == player then table.remove(syncPlayers, i) break end end if (animEnable[source] == true or animEnable[source] == false) then animEnable[source] = nil end end ) I need to restrict this at "VIP" ACL. But it does not work. Someone can help me, pls. Thanks. Submit error: Client (Username Player) triggered serverside event onClientSync, but event is not added serverside. Link to comment
N3xT Posted June 21, 2019 Share Posted June 21, 2019 Line 21 replace resourceRoot with root Link to comment
joao2235 Posted June 21, 2019 Author Share Posted June 21, 2019 local ifp = engineLoadIFP( "anim.ifp", "newAnimBlock" ) addEvent( "anim", true ) addEventHandler( "anim", root, function(enable) if (enable) then setPedAnimation(source, "newAnimBlock", "continencia", -1, true, false) else setPedAnimation(source) end end ) addEventHandler("onClientResourceStart", resourceRoot, function() triggerServerEvent("onClientSync", resourceRoot) end ) addEventHandler("onClientResourceStop", resourceRoot, function() if ifp then for _,player in ipairs(getElementsByType("player")) do local _, anim = getPedAnimation(player) if (anim == "continencia") then setPedAnimation(player) end end destroyElement(ifp) end end ) 21 minutes ago, N3xT said: Line 21 replace resourceRoot with root I did it. But not work. Link to comment
Moderators IIYAMA Posted June 21, 2019 Moderators Share Posted June 21, 2019 Try to change the script order. Serverside first, then clientside. If that doesn't work then serverside has an syntax error or the script is not serverside. Link to comment
joao2235 Posted June 22, 2019 Author Share Posted June 22, 2019 5 hours ago, IIYAMA said: Try to change the script order. Serverside first, then clientside. If that doesn't work then serverside has an syntax error or the script is not serverside. Sorry, I am a beginner. Can u make a better explain ? Link to comment
Moderators IIYAMA Posted June 22, 2019 Moderators Share Posted June 22, 2019 3 hours ago, joao2235 said: Sorry, I am a beginner. Can u make a better explain ? Open the meta.xml Change the script order. 1. <script type="server" (or no type) 2. <script type="client" Link to comment
joao2235 Posted June 23, 2019 Author Share Posted June 23, 2019 Working! I did another thing. 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