Displaying the players name instead of their id. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Displaying the players name instead of their id. (
/showthread.php?tid=121065)
Displaying the players name instead of their id. -
whereschris - 14.01.2010
Okay, I'll make this as short as possible
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[256];
if (IsPlayerConnected(playerid)) {
PlayerInfo[playerid][Deaths]++;
format(string, sizeof(string),"You were killed by: %i and lost $1,000.",killerid);
SendClientMessage(playerid, COLOR,string);//kills deaths etc.
}
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][Kills]++;
format(string, sizeof(string),"You killed: %i and gained $3,000.",playerid);
SendClientMessage(killerid, COLOR,string);//kills deaths etc.
}
return 1;
}
This works fine, although it Displays You killed "id" and gained 3,000 instead of You killed "Players name"
How would I fix this? I didn't know playerid literally displayed there ID.. lol
Re: Displaying the players name instead of their id. -
[HiC]TheKiller - 15.01.2010
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
new string[256];
if (IsPlayerConnected(playerid)) {
PlayerInfo[playerid][Deaths]++;
new Pname[24];
GetPlayerName(playerid, Pname, 24);
format(string, sizeof(string),"You were killed by: %s(%i) and lost $1,000.",Pname,killerid);
SendClientMessage(playerid, COLOR,string);//kills deaths etc.
}
if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
{
PlayerInfo[killerid][Kills]++;
new Pname[24];
GetPlayerName(killerid, Pname, 24);
format(string, sizeof(string),"You killed: %s(%i) and gained $3,000.",Pname, playerid);
SendClientMessage(killerid, COLOR,string);//kills deaths etc.
}
return 1;
}
Re: Displaying the players name instead of their id. -
whereschris - 15.01.2010
Quote:
Originally Posted by [HiC
TheKiller ]
pawn Код:
public OnPlayerDeath(playerid, killerid, reason) { new string[256]; if (IsPlayerConnected(playerid)) { PlayerInfo[playerid][Deaths]++; new Pname[24]; GetPlayerName(playerid, Pname, 24); format(string, sizeof(string),"You were killed by: %s(%i) and lost $1,000.",Pname,killerid); SendClientMessage(playerid, COLOR,string);//kills deaths etc. } if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID) { PlayerInfo[killerid][Kills]++; new Pname[24]; GetPlayerName(killerid, Pname, 24); format(string, sizeof(string),"You killed: %s(%i) and gained $3,000.",Pname, playerid); SendClientMessage(killerid, COLOR,string);//kills deaths etc. } return 1; }
|
This displays You killed "Myname" and you You died by: "Myname" Which does not work.. :\
EDIT:
Fixed it myself, thanks