[Tutorial] Death and Kill Messages.
#2

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SendDeathMessage(killerid, playerid, reason); // Sends Death Message to evryone in server.
    GivePlayerMoney(killerid,100); // Gives killerid 100$
    GivePlayerMoney(playerid,-100); // Takes playerid which died 100$
    new string[128]; // a new string for killerid length 128.
    new diedguy[MAX_PLAYER_NAME]; // Formating name of guy which died.
    new killerguy[MAX_PLAYER_NAME]; // Formating name of guy which killed the other player.
    new gunname[32]; // variable to store weapon name.
    GetWeaponName(reason,gunname,sizeof(gunname)); // Formating reason with gunname.
    GetPlayerName(killerid,killerguy,sizeof(killerguy)); // Formating killer name.
    GetPlayerName(playerid,diedguy,sizeof(diedguy)); // Formating died guy name.
    format(string,sizeof(string),"[SERVER]:Good job on killing %s with %s you got 100$ as reward.",diedguy,gunname); // formating the string with died guy and gunname.
    SendClientMessage(killerid,COLOR_YELLOW,string); // String sended to guy which got the kill.
    format(string,sizeof(string),"[SERVER]:You were killed by %s using %s you lost 100$",killerguy,gunname); // Same as first string.
    SendClientMessage(playerid,COLOR_YELLOW,string);// String sended to guy which died.
    return 1;
}
more better no need for string2 only will make compiling slow (by a bit if u keep using it like that slowly slowly will effect a lot)
Reply


Messages In This Thread
Death and Kill Messages. - by Gogeta101 - 22.09.2014, 15:46
Re: Death and Kill Messages. - by AroseKhanNiazi - 22.09.2014, 16:27
Re: Death and Kill Messages. - by Gogeta101 - 22.09.2014, 16:29
Re: Death and Kill Messages. - by KayJ - 23.09.2014, 09:29
Re: Death and Kill Messages. - by Vince - 23.09.2014, 12:41
Re: Death and Kill Messages. - by DavidBilla - 23.09.2014, 13:38

Forum Jump:


Users browsing this thread: 1 Guest(s)