SA-MP Forums Archive
How do I show the person I killed in my Chatbox - 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)
+--- Thread: How do I show the person I killed in my Chatbox (/showthread.php?tid=365661)



How do I show the person I killed in my Chatbox - Eminem 2ka9 - 03.08.2012

I want it like this when I kill someone: You got 2 score for killing [Person I killed] That's all!

Here's my code:

public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
SetPlayerPos(playerid, 2134.5957,1332.6907,10.8251);
SetPlayerScore(killerid,GetPlayerScore(killerid)+2 );
for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
GivePlayerMoney(killerid, 2500);
SendClientMessage(killerid, COLOR_LIGHTBLUE, "You got 2500 Cash and 2 Score for killing);
SendClientMessage(playerid, COLOR_BRIGHTRED, "You just got killed!");
SetPlayerFacingAngle(playerid,0);


Re: How do I show the person I killed in my Chatbox - DeathOnaStick - 03.08.2012

pawn Code:
new str[128],pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(str, sizeof(str), "You got 2 points for killing %s!", pName);
SendClientMessage(killerid, COLOR_LIGHTBLUE, str);
This should do.


Re: How do I show the person I killed in my Chatbox - FalconX - 03.08.2012

Quote:
Originally Posted by Eminem 2ka9
View Post
I want it like this when I kill someone: You got 2 score for killing [Person I killed] That's all!

Here's my code:

public OnPlayerDeath(playerid, killerid, reason)
{
SendDeathMessage(killerid, playerid, reason);
SetPlayerPos(playerid, 2134.5957,1332.6907,10.8251);
SetPlayerScore(killerid,GetPlayerScore(killerid)+2 );
for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
GivePlayerMoney(killerid, 2500);
SendClientMessage(killerid, COLOR_LIGHTBLUE, "You got 2500 Cash and 2 Score for killing);
SendClientMessage(playerid, COLOR_BRIGHTRED, "You just got killed!");
SetPlayerFacingAngle(playerid,0);
pawn Code:
public OnPlayerDeath( playerid, killerid, reason )
{
    SendDeathMessage( killerid, playerid, reason );
   
    SetPlayerPos( playerid, 2134.5957,1332.6907,10.8251 );
   
    SetPlayerScore( killerid,GetPlayerScore(killerid)+2 );
    for(new i=0; i<19; i++) TextDrawHideForPlayer(playerid,HealthBar[i]);
    GivePlayerMoney(killerid, 2500);
   
    new szName[ MAX_PLAYER_NAME ], szStr[ 60 ];
   
    GetPlayerName( playerid, szName, sizeof( szName ) );
   
    format( szStr, sizeof( szStr ), "You got +2 score for killing %s", szName ); // change this message to your own
   
    SendClientMessage( killerid, COLOR_LIGHTBLUE, szStr );
   
    SendClientMessage(playerid, COLOR_BRIGHTRED, "You just got killed!");
   
    SetPlayerFacingAngle(playerid,0);
Wow, I am late lol.

Hope this helps mate.

Regards,
FalconX


Re: How do I show the person I killed in my Chatbox - Eminem 2ka9 - 03.08.2012

Wow thanks, damn these forums are awesome!


Re: How do I show the person I killed in my Chatbox - FalconX - 03.08.2012

Quote:
Originally Posted by Eminem 2ka9
View Post
Wow thanks, damn these forums are awesome!
Glad it helped you mate!


Re: How do I show the person I killed in my Chatbox - DeathOnaStick - 03.08.2012

Quote:
Originally Posted by Eminem 2ka9
View Post
Wow thanks, damn these forums are awesome!
You're welcome