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



Stats - Ananisiki - 06.04.2014

When an admin kills another player, he is supposed to not loose anything (money)

i have a stats command with textdraws, everytime i am on admin mode and kill another player, the admins score gets +1, how can i stop this?


and i have messages like

%s died. by %s

i want to hide this too when an admin kills a player also hide the death reason, how can i do it?


Re: Stats - LocMax - 07.04.2014

Show your OnPlayerDeath code.


Re: Stats - Ananisiki - 13.04.2014

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new kName[128];
    new pID;
    new string[500+MAX_PLAYER_NAME];
    Dead[playerid] = 1;
//    SetPlayerScore(playerid, GetPlayerScore(playerid) -1);
    SetPlayerScore(killerid, GetPlayerScore(killerid) +1);
//    KillingSpree[killerid] ++;
    KillingSpree[playerid] = 0;
    if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID)
    {
        new WeapName[32], Name[MAX_PLAYER_NAME], KillerName[MAX_PLAYER_NAME];
        GetWeaponName(reason, WeapName, sizeof(WeapName));
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        GetPlayerName(killerid, KillerName, MAX_PLAYER_NAME);
        format(string, sizeof(string),"%s (%d) Died. Killed By: %s (%d) - %s. ", Name, playerid, KillerName, killerid, WeapName);
        SendClientMessageToAll(COLOR_DARKRED, string);
    }
    else
    {
        new Name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
        format(string, sizeof(string),"%s (%d) Died.", Name, playerid);
        SendClientMessageToAll(COLOR_DARKRED, string);
    }
    if(InDMS[playerid] == 1)
    {
        new Random = random(sizeof(RandomDMSpawns));
        SetPlayerPos(playerid, RandomDMSpawns[Random][0], RandomDMSpawns[Random][1], RandomDMSpawns[Random][2]);
        SetPlayerFacingAngle(playerid, RandomDMSpawns[Random][3]);
        SetTimer("DMSTimer", 3000, false);
    }

    else SendDeathMessage(killerid, playerid, reason);



Re: Stats - BroZeus - 13.04.2014

do like this --
pawn Код:
new bool:IsKilledByAdmin[MAX_PLAYERS]=false;//on top

IsKilledByAdmin[targetid]=true;//this in admin kill command targetid=the player killed

if(IsKilledByAdmin[playerid]==true)return IsKilledByAdmin[playerid]=false;//this OnPlayerDeath on top of all things



Re: Stats - Ananisiki - 13.04.2014

Don't work


Re: Stats - Ananisiki - 14.04.2014

Bump


Re: Stats - RoboN1X - 14.04.2014

You have to check first if the killer is an admin,
By doing this:
pawn Код:
if(IsPlayerAdmin(killerid))
{
// killer was an admin
}
else
{
// killer was not an admin
}
That's for the RCON admin, but if you have an admin system using like "level" it might be look like this:
pawn Код:
if(pLevel[killerid] > 0)
{
// killer's level is more than 0, which is admin level 1 or higher.
}
else
{
// kiler's level 0 or not admin
}
In this case, you need to use your own "admin level" variable, since you didn't show us the variable to mark the player as "admin", don't just copy paste the code and say it's give error or not working.

Note: You should place it after this code, to check if the killerid is valid (read here for the reason):
pawn Код:
if(killerid != INVALID_PLAYER_ID)
{
// code here



Re: Stats - Ananisiki - 15.04.2014

Dont really understand, my admin is this

pawn Код:
Duty[playerid] = 1;
SetPVarInt(playerid, "Amode", 1);



Re: Stats - RoboN1X - 15.04.2014

Quote:
Originally Posted by Ananisiki
Посмотреть сообщение
Dont really understand, my admin is this

pawn Код:
Duty[playerid] = 1;
SetPVarInt(playerid, "Amode", 1);
then make it like
pawn Код:
if(Duty[killerid] == 1 || GetPVarInt(killerid, "Amode") == 1)
{
// killed by on duty admin
}
else
{
// not killed by on duty admin
}



Re: Stats - Ananisiki - 15.04.2014

I dont want to show death messages when admin killed and not kill in deathlist and not get Deaths: -1 or Kills: 1 in stats, how i do