SA-MP Forums Archive
OnPlayerDeath - 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: OnPlayerDeath (/showthread.php?tid=412088)



OnPlayerDeath - Kudoz - 31.01.2013

Hello!

I got this script;
Код:
 public OnPlayerDeath(playerid, killerid, reason)
{
	isInMg[playerid] = 0;
	SetPlayerPos(playerid, -1916.8977,293.7148,40.7085);
	SetPlayerVirtualWorld(playerid, 0);
	SetPlayerInterior(playerid, 0);
	SendClientMessage(playerid, lightgreen,"{B4B5B7}.: You've been removed from The Hunger Games. :.");
	new jstring[128];
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	format(jstring, sizeof(jstring), ".: {B4B5B7}( %s ) has died in The Hunger Games! The last man standing is the winner! {9ACD32}:.", playername);
	SendClientMessageToAll(lightgreen, jstring);
	SendDeathMessage(killerid, playerid, reason);
	GivePlayerMoney(playerid, 10000);
    return 1;
}
When a player dies, it says, for example; ( Kudoz ) has died in The Hunger Games! .... blah blah ", but I want it like, IF a player is "isInMg[playerid] = 1;", then it says that, but when it is "isInMg[playerid] = 0;" , then it will just SendDeathMessage. It was kinda hard to explain, but I hope you understood


Re: OnPlayerDeath - DiGiTaL_AnGeL - 31.01.2013

You should really learn how to check variables
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if(isInMg[playerid] = 1)
    {
        isInMg[playerid] = 0;
        SetPlayerPos(playerid, -1916.8977,293.7148,40.7085);
        SetPlayerVirtualWorld(playerid, 0);
        SetPlayerInterior(playerid, 0);
        SendClientMessage(playerid, lightgreen,"{B4B5B7}.: You've been removed from The Hunger Games. :.");
        new jstring[128];
        new playername[MAX_PLAYER_NAME];
        GetPlayerName(playerid, playername, sizeof(playername));
        format(jstring, sizeof(jstring), ".: {B4B5B7}( %s ) has died in The Hunger Games! The last man standing is the winner! {9ACD32}:.", playername);
        SendClientMessageToAll(lightgreen, jstring);
        SendDeathMessage(killerid, playerid, reason);
        GivePlayerMoney(playerid, 10000);
    }
    return 1;
}



Re: OnPlayerDeath - Kudoz - 31.01.2013

Nice, thanks! But if they die outside the hunger games, will it SendDeathMessage?


AW: OnPlayerDeath - Blackazur - 31.01.2013

Yep, it will.


Re: OnPlayerDeath - Kudoz - 31.01.2013

Alright, thanks.


Re: OnPlayerDeath - Bakr - 31.01.2013

pawn Код:
if(isInMg[playerid] == 1)