Getting a other player name
#1

How can i get that?


I have now this;

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Random = random(8001);
    killtimer1 = SetTimerEx("killtimer2",35000,0,"d",playerid);
    new pname[24];
    new string[130];
   	GivePlayerMoney(playerid,Random);
   	GetPlayerName(playerid, pname, sizeof(pname));
   	format(string, sizeof(string), "[KILL] "white"%s "green"Is killed by "white"%s. "red"Cash reward: %d", pname, killerid, Random);
   	SendClientMessageToAll(COLOR_RED, string);
    return 1;
}
But how can i get with a code the name from the other player that killed the guy?
Reply
#2

Well, just declare a variable with a MAX_PLAYER_NAME cell, get the killerid name and store it in the variable:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new Random = random(8001);
    killtimer1 = SetTimerEx("killtimer2",35000,0,"d",playerid);
    new pname[24];
    new string[130];
    new killername[ MAX_PLAYER_NAME ]; // New
    GivePlayerMoney(playerid,Random);
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerName( killerid, killername, MAX_PLAYER_NAME ); // New
    format(string, sizeof(string), "[KILL] "white"%s "green"Is killed by "white"%s. "red"Cash reward: %d", pname, killername, Random); // killerid to killername
    SendClientMessageToAll(COLOR_RED, string);
    return 1;
}
Reply
#3

Mm, it repeats the name ;O? I get 2 times the name of the guy that is killed...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)