#Dv^ Posted July 25, 2016 Posted July 25, 2016 Hola! Perdonen, ¿Cómo puedo hacer para que los players no puedan matar con Knife si no están en Ware? Use algo como esto pero no funciona function abortAllStealthKills(thePlayer) if ( getElementInterior(thePlayer) == 1 ) then cancelEvent(true) else cancelEvent(false) end end addEventHandler("onClientPlayerStealthKill", root, abortAllStealthKills) Muchas Gracias
Destroyer.- Posted July 25, 2016 Posted July 25, 2016 function abortAllStealthKills(thePlayer) if ( getElementInterior(thePlayer) == 1 ) then cancelEvent() end end addEventHandler("onClientPlayerStealthKill", root, abortAllStealthKills)
Destroyer.- Posted July 25, 2016 Posted July 25, 2016 Muchas Gracias! Eso me sirvió! De nada , recuerda que cancelEvent no lleva argumentos en client
#Dv^ Posted July 25, 2016 Author Posted July 25, 2016 Disculpa que pregunte, para no abrir otro tema Si pongo un comando /sd por ejemplo, y al poner no pueda hacer daño a los players con ningún arma, y al poner /sd de nuevo si pueda hacer daño de nuevo, ¿Qué debo usar para eso? Gracias
Sasu Posted July 25, 2016 Posted July 25, 2016 addCommandHandler addEventHandler removeEventHandler "onClientPlayerDamage" -- + una variable boolean(false/true) para saber si esta activado o no
#Dv^ Posted July 25, 2016 Author Posted July 25, 2016 Lo hice así, pero aún no me funciona addEventHandler ("onClientPlayerDamage", getLocalPlayer(), function (atac) if getElementType (atac) == "player" and getElementData(atac, "damage") == true then cancelEvent ( ) end end )
aka Blue Posted July 25, 2016 Posted July 25, 2016 No te recomiendo usar elementData para estas cosas tan simples. Utiliza tablas o variables: local damage = { } addCommandHandler( "sd", function( ) local estado = damage[ localPlayer ] if estado == nil or estado == false then outputChatBox( "Ahora ya no puedes matar a nadie.", 255, 0, 0 ) estado[ localPlayer ] = true else outputChatBox( "Ahora puedes matar a todos los jugadores.", 0, 255, 0 ) estado[ localPlayer ] = false end end ) function cancelarDamage ( attacker, _, _ ) local estado_atacador = damage[ attacker ] if ( estado_atacador == true ) then cancelEvent( ) -- Si el atacador tiene el daño desactivado end end addEventHandler ( "onClientPlayerDamage", root, cancelarDamage )
Recommended Posts