OnPlayerDeath
#1

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
Reply
#2

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
Reply
#3

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 -.-
Reply
#4

i still cant get it -.-
Reply
#5

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

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 )
Reply
#7

Solution founded using djSon , check your pm's
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)