abelito Posted February 17, 2023 Share Posted February 17, 2023 function playerDamage_text ( attacker, weapon, bodypart, loss ) --when a player is damaged if ( bodypart == 9 and attacker and attacker ~= source ) then -- if the body part is 9 (head) and there is an attacker and it wasn't self damage outputChatBox ( "Headshot!", attacker, 255, 170, 0 ) --output "Headshot" into the chatbox killPed ( source, attacker, weapon, bodypart ) -- and kill the player end end addEventHandler ( "onPlayerDamage", root, playerDamage_text ) --add an event handler for the onPlayerDamage event Link to comment
Moderators Vinyard Posted February 17, 2023 Moderators Share Posted February 17, 2023 Hi, welcome to the forums! Your thread has been moved to the Spanish scripting section so you can get better help in your native language. Make sure to always use English when posting outside this language-specific section! 1 Link to comment
Fonz Posted February 20, 2023 Share Posted February 20, 2023 (edited) Tu script no parece contener ningún error aparente en cuanto a sintaxis, y en teoría debería funcionar correctamente. La función "playerDamage_text" se activará cada vez que un jugador reciba daño, y si el daño fue infligido en la cabeza por otro jugador, se mostrará un mensaje "Headshot" en el chat y se matará al jugador. Debes ser más específico sobre si tienes algún problema o error que estés experimentando para poder ayudarte. Siempre puedes preguntar en la sección "es-scripting" en el servidor de Discord MTA para obtener ayuda. Edited February 20, 2023 by Fonz 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