17.12.2015, 06:00
Код:
public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, reason); if (killerid != INVALID_PLAYER_ID) { Log_Write("logs/kill_log.txt", "[%s] %s has killed %s (%s).", ReturnDate(), ReturnName(killerid), ReturnName(playerid), DeathReason[reason]); SendClientMessageToAllEx(-1, "{FF0000}%s Died. Killed By %s (%s).", ReturnName(playerid), ReturnName(killerid), DeathReason[reason]); } else { Log_Write("logs/kill_log.txt", "[%s] %s has killed %s (reason %d).", ReturnDate(), ReturnName(killerid), ReturnName(playerid), DeathReason[reason]); SendClientMessageToAllEx(-1, "{FF0000}%s Died (%s).", ReturnName(playerid), DeathReason[reason]); } return 1; }
Well, this stock is by emmet_, ill post the code.
Код:
stock SendClientMessageToAllEx(color, const text[], {Float, _}:...) { static args, str[144]; /* * Custom function that uses #emit to format variables into a string. * This code is very fragile; touching any code here will cause crashing! */ if ((args = numargs()) == 2) { SendClientMessageToAll(color, text); } else { while (--args >= 2) { #emit LCTRL 5 #emit LOAD.alt args #emit SHL.C.alt 2 #emit ADD.C 12 #emit ADD #emit LOAD.I #emit PUSH.pri } #emit PUSH.S text #emit PUSH.C 144 #emit PUSH.C str #emit LOAD.S.pri 8 #emit ADD.C 4 #emit PUSH.pri #emit SYSREQ.C format #emit LCTRL 5 #emit SCTRL 4 SendClientMessageToAll(color, str); #emit RETN } return 1; }
