OnPlayerDeath
#1

When someone is killed i want to give the killer 1000 $ and to say this "You have killed "playername" and earned 1000 $"-that's for the killer, and for the playerid who has been killed "You have been killed by "killername". Is it possible
Reply
#2

Yes it is possible and easy to impliment.
Reply
#3

Could you please write the script? , I am a little new to this!
Reply
#4

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    GivePlayerMoney(killerid, 1000);
    SendClientMessage(killerid, Here Color, "You Killed Him");
    GivePlayerMoney(playerid, -1000);
    SendClientMessage(playerid, "you Have Been Killed");
    return 1;
}
Reply
#5

I want it to say who the killerid killed, and the playerid to see who has killed him
Reply
#6

use strings then
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128],killed[MAX_PLAYER_NAME],killer[MAX_PLAYER_NAME];
    GetPlayerName(playerid,killed,sizeof(killed));
    GetPlayerName(killerid,killer,sizeof(killer));
    format(string,sizeof(string),"%s has been killed by %s",killed,killer);
    SendClientMessage(playerid,0xAA3333AA,string);
    return 1;
}
Reply
#7

Quote:
Originally Posted by tuuker
Посмотреть сообщение
use strings then
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new string[128],killed[MAX_PLAYER_NAME],killer[MAX_PLAYER_NAME];
    GetPlayerName(playerid,killed,sizeof(killed));
    GetPlayerName(killerid,killer,sizeof(killer));
    format(string,sizeof(string),"%s has been killed by %s",killed,killer);
    SendClientMessage(playerid,0xAA3333AA,string);
    return 1;
}
I totally agree. Nice and easy.
But if you have alot of players killing each other, it will spam your chatbox area abit.
Reply
#8

Quote:
Originally Posted by yoan103
Посмотреть сообщение
I want it to say who the killerid killed, and the playerid to see who has killed him
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new tokiller[128],tokilled[128],killed[MAX_PLAYER_NAME],killer[MAX_PLAYER_NAME];
    GetPlayerName(playerid,killed,sizeof(killed));
    GetPlayerName(killerid,killer,sizeof(killer));
    format(tokiller,sizeof(tokiller),"You have killed %s and earned 1000$",killed);
    SendClientMessage(killerid,0xAA3333AA,tokiller);
    format(tokilled,sizeof(tokilled),"You have been killed by %s",killer);
    GivePlayerMoney(killerid,1000);
    return 1;
}
Reply
#9

Simple one lol.
Reply
#10

Quote:
Originally Posted by tuuker
Посмотреть сообщение
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new tokiller[128],tokilled[128],killed[MAX_PLAYER_NAME],killer[MAX_PLAYER_NAME];
    GetPlayerName(playerid,killed,sizeof(killed));
    GetPlayerName(killerid,killer,sizeof(killer));
    format(tokiller,sizeof(tokiller),"You have killed %s and earned 1000$",killed);
    SendClientMessage(killerid,0xAA3333AA,tokiller);
    format(tokilled,sizeof(tokilled),"You have been killed by %s",killer);
    GivePlayerMoney(killerid,1000);
    return 1;
}
You forgot to add SendClientMessage to Playerid.

Fixed Code:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new
        tokiller[128],
        tokilled[128],
        killed[MAX_PLAYER_NAME],
        killer[MAX_PLAYER_NAME]
    ;

    GetPlayerName(playerid,killed,sizeof(killed));

    GetPlayerName(killerid,killer,sizeof(killer));
   
    format(tokiller,sizeof(tokiller),"You have killed %s and earned 1000$",killed);
    SendClientMessage(killerid,0xAA3333AA,tokiller);
   
    format(tokilled,sizeof(tokilled),"You have been killed by %s",killer);
    SendClientMessage(playerid,0xAA3333AA,tokilled);
   
    GivePlayerMoney(killerid,1000);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)