SA-MP Forums Archive
Player kill log - 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: Player kill log (/showthread.php?tid=530173)



Player kill log - Hybris - 05.08.2014

Hello I was wondering if anyone can help me out here i've been trying to make a kill/death log that only admins can see but I had no success here is the code that I tried.
Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    new msg[128], killerName[MAX_PLAYER_NAME], reasonMsg[32], playerName[MAX_PLAYER_NAME];
    GetPlayerName(killerid, killerName, sizeof(killerName));
    GetPlayerName(playerid, playerName, sizeof(playerName));
    if (killerid != INVALID_PLAYER_ID)
    {
        switch (reason)
        {
            case 0: reasonMsg = "Unarmed";
            case 1: reasonMsg = "Brass Knuckles";
            case 2: reasonMsg = "Golf Club";
            case 3: reasonMsg = "Night Stick";
            case 4: reasonMsg = "Knife";
            case 5: reasonMsg = "Baseball Bat";
            case 6: reasonMsg = "Shovel";
            case 7: reasonMsg = "Pool Cue";
            case 8: reasonMsg = "Katana";
            case 9: reasonMsg = "Chainsaw";
            case 10: reasonMsg = "Dildo";
            case 11: reasonMsg = "Dildo";
            case 12: reasonMsg = "Vibrator";
            case 13: reasonMsg = "Vibrator";
            case 14: reasonMsg = "Flowers";
            case 15: reasonMsg = "Cane";
            case 22: reasonMsg = "Pistol";
            case 23: reasonMsg = "Silenced Pistol";
            case 24: reasonMsg = "Desert Eagle";
            case 25: reasonMsg = "Shotgun";
            case 26: reasonMsg = "Sawn-off Shotgun";
            case 27: reasonMsg = "Combat Shotgun";
            case 28: reasonMsg = "MAC-10";
            case 29: reasonMsg = "MP5";
            case 30: reasonMsg = "AK-47";
            case 31: reasonMsg = "M4";
            case 32: reasonMsg = "TEC-9";
            case 33: reasonMsg = "Country Rifle";
            case 34: reasonMsg = "Sniper Rifle";
            case 37: reasonMsg = "Fire";
            case 38: reasonMsg = "Minigun";
            case 41: reasonMsg = "Spray Can";
            case 42: reasonMsg = "Fire Extinguisher";
            case 49: reasonMsg = "Vehicle Collision";
            case 50: reasonMsg = "Vehicle Collision";
            case 51: reasonMsg = "Explosion";
            default: reasonMsg = "Unknown";
        }
        format(msg, sizeof(msg), " %s killed %s. (%s)", killerName, playerName, reasonMsg);
    }
    else
    {
        switch (reason)
        {
            case 53: format(msg, sizeof(msg), " %s died. (Drowned)", playerName);
            case 54: format(msg, sizeof(msg), " %s died. (Collision)", playerName);
            default: format(msg, sizeof(msg), " %s died.", playerName);
        }
    }
I tried putting it so it sends the msg to the admins but im clueless I tryed putting instead of
Код:
format(msg, sizeof(msg),
to SendMessageToAllAdmins I was wondering if anyone can help me out?
I just wanted it to send the admin a message that %s has been killed by %s with (gun name) thats all.


Re: Player kill log - JessThompson - 05.08.2014

I use

pawn Код:
public SendAdminMessage(color, string[])
{
    foreach(Player, i)
    {
            if(PlayerInfo[i][pAdmin] >= 1) // your admin system here
            {
                SendClientMessageEx(i, color, string);
            }
    }
}
So add something like this

new string[128];
format(string,sizeof(string),"Warning: %s may be server advertising: '%s'.", GetPlayerNameEx(playerid),cmdtext);
SendAdminMessage(COLOR_RED, string);


Re: Player kill log - Hybris - 05.08.2014

Quote:
Originally Posted by JessThompson
Посмотреть сообщение
I use

pawn Код:
public SendAdminMessage(color, string[])
{
    foreach(Player, i)
    {
            if(PlayerInfo[i][pAdmin] >= 1) // your admin system here
            {
                SendClientMessageEx(i, color, string);
            }
    }
}
So add something like this

new string[128];
format(string,sizeof(string),"Warning: %s may be server advertising: '%s'.", GetPlayerNameEx(playerid),cmdtext);
SendAdminMessage(COLOR_RED, string);
That doesnt work


Re: Player kill log - AhmedGang - 05.08.2014

sorry missed


Re: Player kill log - JessThompson - 05.08.2014

Have your forwarded this
pawn Код:
public SendAdminMessage(color, string[])
{
    foreach(Player, i)
    {
            if(PlayerInfo[i][pAdmin] >= 1) // your admin system here
            {
                SendClientMessageEx(i, color, string);
            }
    }
}
And where you normaly send the death message change it to SendAdminMessage(COLOR_RED, msg);


EG. Change the thing that is called SendClientMessage(playerid, blah blah.... to SendAdminMessage(COLOR_RED, msg);


Re: Player kill log - JessThompson - 05.08.2014

Quote:
Originally Posted by AhmedGang
Посмотреть сообщение
Put that:
pawn Код:
SendClientMessage(playerid,-1,msg)
after that
pawn Код:
format(msg, sizeof(msg), " %s killed %s. (%s)", killerName, playerName, reasonMsg);
Or like this guys said but not SendClientMessage(player,-1,msg) this SendAdminMessage(COLOR_RED, msg);


Re: Player kill log - AhmedGang - 05.08.2014

that was i meant but he tried it as he say in the last of the thread


Re: Player kill log - AhmedGang - 05.08.2014

oh oh replace killername with killerid and playername with playerid , dun define it it's already defined in onplayerdeath callback