SA-MP Forums Archive
Problem actor damage sendcilentmessagetoall - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem actor damage sendcilentmessagetoall (/showthread.php?tid=638901)



Problem actor damage sendcilentmessagetoall - vegaltasendai - 07.08.2017

I have problem with this script sends messages to all, I want to just send the player to harm the actor

https://sampwiki.blast.hk/wiki/OnPlayerGiveDamageActor

Код:
public OnPlayerGiveDamageActor(playerid, damaged_actorid, Float: amount, weaponid, bodypart)
{
    new string[128], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetWeaponName(weaponid, weaponname, sizeof (weaponname));
 
    format(string, sizeof(string), "%s has made %.0f damage to actor id %d, weapon: %s", attacker, amount, damaged_actorid, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);
    return 1;
}
This line Gives messages to everyone and chat
SendClientMessageToAll(0xFFFFFFFF, string);


Re: Problem actor damage sendcilentmessagetoall - Dirki - 07.08.2017

If you want to change to announce to the player who gave the actor damage, replace:
pawn Код:
SendClientMessageToAll(0xFFFFFFFF, string);
with:
pawn Код:
SendClientMessage(playerid, 0xFFFFFFFF, string);
as playerid (as stated in the callback) refers to the player who has given damage.


Re: Problem actor damage sendcilentmessagetoall - Vince - 07.08.2017

Perhaps you should look up the meaning of the word "all" in a dictionary? The script is doing exactly what you're telling it to do.


Re: Problem actor damage sendcilentmessagetoall - vegaltasendai - 07.08.2017

Quote:
Originally Posted by Dirki
Посмотреть сообщение
If you want to change to announce to the player who gave the actor damage, replace:
pawn Код:
SendClientMessageToAll(0xFFFFFFFF, string);
with:
pawn Код:
SendClientMessage(playerid, 0xFFFFFFFF, string);
as playerid (as stated in the callback) refers to the player who has given damage.
Thanks i was doing wrong the code is now okay.