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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: OnPlayerDeath (/showthread.php?tid=179556)



OnPlayerDeath - FireCat - 27.09.2010

hi, can anyone help me like it send the OnPlayerDeath only to admins?
my code is:
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 #if defined USE_STATS
    PlayerInfo[playerid][Deaths]++;
    #endif
    InDuel[playerid] = 0;

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        #if defined USE_STATS
        PlayerInfo[killerid][Kills]++;
        #endif

        if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
            GameTextForPlayer(killerid,"Winner !",3000,3);
            InDuel[killerid] = 0;
            SetPlayerPos(killerid, 0.0, 0.0, 0.0);
            SpawnPlayer(killerid);
        }
        else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
        }
        if(PlayerInfo[playerid][Level] >= 1)
        SendDeathMessage(killerid, playerid, reason);
    }

    #if defined ENABLE_SPEC
    for(new x=0; x<MAX_PLAYERS; x++)
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
           AdvanceSpectate(x);
    #endif
    if(PlayerInfo[playerid][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
    SendDeathMessage(killerid, playerid, reason);/////////////////////////////////////////////////////////////////// code here
    return 1;
}
can anyone help me? xD


Re: OnPlayerDeath - Mike_Peterson - 27.09.2010

SendDeathMessage is global so it will show on the whole server, i fixed some things


Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[128];
	#if defined USE_STATS
    PlayerInfo[playerid][Deaths]++;
    #endif
    InDuel[playerid] = 0;

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        #if defined USE_STATS
        PlayerInfo[killerid][Kills]++;
        #endif

        if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
            GameTextForPlayer(killerid,"Winner !",3000,3);
            InDuel[killerid] = 0;
            SetPlayerPos(killerid, 0.0, 0.0, 0.0);
            SpawnPlayer(killerid);
        }
        else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
        }
        if(PlayerInfo[playerid][Level] >= 1)
        format(string, sizeof(string), "%s has killed %s.", othername,name);
        SendClientMessage(playerid,YOURCOLOR, string);
    }

    #if defined ENABLE_SPEC
    for(new x=0; x<MAX_PLAYERS; x++)
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
           AdvanceSpectate(x);
    #endif
    if(PlayerInfo[x][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
   	format(string, sizeof(string), "%s has killed %s.", othername,name);
   	SendClientMessage(x,YOURCOLOR, string);
    return 1;
}
this should do the trick


Re: OnPlayerDeath - FireCat - 27.09.2010

Quote:
Originally Posted by Mike_Peterson
Посмотреть сообщение
SendDeathMessage is global so it will show on the whole server, i fixed some things


Код:
public OnPlayerDeath(playerid, killerid, reason)
{
	new string[128];
	#if defined USE_STATS
    PlayerInfo[playerid][Deaths]++;
    #endif
    InDuel[playerid] = 0;

    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        #if defined USE_STATS
        PlayerInfo[killerid][Kills]++;
        #endif

        if(InDuel[playerid] == 1 && InDuel[killerid] == 1)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
            GameTextForPlayer(killerid,"Winner !",3000,3);
            InDuel[killerid] = 0;
            SetPlayerPos(killerid, 0.0, 0.0, 0.0);
            SpawnPlayer(killerid);
        }
        else if(InDuel[playerid] == 1 && InDuel[killerid] == 0)
        {
            GameTextForPlayer(playerid,"Loser !",3000,3);
        }
        if(PlayerInfo[playerid][Level] >= 1)
        format(string, sizeof(string), "%s has killed %s.", othername,name);
        SendClientMessage(playerid,YOURCOLOR, string);
    }

    #if defined ENABLE_SPEC
    for(new x=0; x<MAX_PLAYERS; x++)
        if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid)
           AdvanceSpectate(x);
    #endif
    if(PlayerInfo[x][Level] >= 1)////////////////////////////////////////////////////////////////////////// code here
   	format(string, sizeof(string), "%s has killed %s.", othername,name);
   	SendClientMessage(x,YOURCOLOR, string);
    return 1;
}
this should do the trick
nope didnt work -.-


Re: OnPlayerDeath - FireCat - 27.09.2010

i still cant get it -.-


Re: OnPlayerDeath - Claude - 27.09.2010

You can't send DeathMessage only to admins, it is a global function that can't be changed from itself (local / public / specified group)


Re: OnPlayerDeath - Mike_Peterson - 27.09.2010

It didnt work at all? i dont think that... did it compile with errors? and yes i already said above my post that i changed death message with text as in: Mike killed FireCat) xD
look at the parameters of SendDeathMessage
Killer ( The killer who killed teh Killee )
Killee ( The one who got killed by the killer )
Weapon ( Used weapon at the murder )


Re: OnPlayerDeath - nepstep - 27.09.2010

Solution founded using djSon , check your pm's