WeeD1 Posted July 5, 2020 Posted July 5, 2020 Alguém me ajuda pfv? Preciso que o código rode no lado server.Lua, no entanto ele está como client. Já fiz algumas tentativas trocando o "localPlayer" por source, thePlayer, etc. Mas não consegui, o que estou fazendo de errado? function stopAnimation() if getPedAnimation(localPlayer) then setPedAnimation(localPlayer, false) end end addCommandHandler('anim', stopAnimation) bindKey("F3", "down", stopAnimation)
Blaack Posted July 5, 2020 Posted July 5, 2020 9 hours ago, WeeD1 said: Alguém me ajuda pfv? Preciso que o código rode no lado server.Lua, no entanto ele está como client. Já fiz algumas tentativas trocando o "localPlayer" por source, thePlayer, etc. Mas não consegui, o que estou fazendo de errado? function stopAnimation() if getPedAnimation(localPlayer) then setPedAnimation(localPlayer, false) end end addCommandHandler('anim', stopAnimation) bindKey("F3", "down", stopAnimation) Simples, getPedAnimation = client-function... Não funcionará em um arquivo server men... Tente: server-only: function stopAnimation(thePlayer) setPedAnimation(thePlayer) end addCommandHandler('anim', stopAnimation) function stopAnimationKey() bindKey(player, "F3", "down", "anim") end addEventHandler ("onPlayerLogin",getRootElement(),stopAnimationKey) 1
WeeD1 Posted July 5, 2020 Author Posted July 5, 2020 (edited) Fiz o teste aqui, por comando /anim está funcionando normal. Porém a bindkey ainda não, não apresentou nenhum erro no debugscript 3, como resolver? (Já reloguei do servidor algumas vezes e nada) Edited July 5, 2020 by WeeD1
Blaack Posted July 5, 2020 Posted July 5, 2020 2 hours ago, WeeD1 said: Fiz o teste aqui, por comando /anim está funcionando normal. Porém a bindkey ainda não, não apresentou nenhum erro no debugscript 3, como resolver? (Já reloguei do servidor algumas vezes e nada) Eu coloquei o evento ao se logar, então ti terá que dar /logout e se logar novamente, ou melhor... tente: function stopAnimation(thePlayer) setPedAnimation(thePlayer) end addCommandHandler('anim', stopAnimation) function stopAnimationKey() bindKey(player, "F3", "down", "anim") end addEventHandler ("onPlayerLogin",getRootElement(),stopAnimationKey) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs(getElementsByType("player")) do bindKey ( player, "F3", "down", "anim" ) end end) 1
WeeD1 Posted July 5, 2020 Author Posted July 5, 2020 Sim, eu estava fazendo o login. Fiz o teste novamente com o código que você mandou atualizado, quando o resource é ativado ele funciona normalmente, porém se eu relogar ele para de funcionar (mesmo fazendo o login), ainda não aponta nenhum erro de debugscript, porém não funciona. 1
Blaack Posted July 5, 2020 Posted July 5, 2020 Perdão, isso foi erro meu ! na linha 7, substitua player por source 1
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