/lastkill and /lastdeath
#1

Hey Guys,
I want to have the Commands /lastkill and /lastdeath to see which Player was killed from some outher Player.
Can you help me?
Sorry for my bad english iґm from Germany
Reply
#2

Insert this code under OnPlayerDeath
Код:
SendDeathMessage(killerid,playerid,reason);
Reply
#3

I know that Code but i donґt want it on the left site
I want it with an Command for Admin
Reply
#4

pawn Код:
lastkillid;
lastdeathid;
And onplayerdeath

pawn Код:
lastkillid = killerid;
lastdeathid = playerid;
pawn Код:
CMD:lastkill(playerid, params[])
{
new string[128];
format(string,sizeof(string),"Last Kill: %s(%d)",GetName(lastkillid),lastkillid);
SendClientMessage(playerid, -1, string);
return 1;
}
CMD:lastdeath(playerid,params[])
{
new string[128];
format(string,sizeof(string),"Last Death: %s(%d)",GetName(lastdeathid),lastdeathid);
SendClientMessage(playerid,-1,string);
return 1;
}
pawn Код:
stock GetName(playerid)
{
    new getthename[MAX_PLAYER_NAME];
    GetPlayerName(playerid,getthename,sizeof(getthename));
    return getthename;
}
Is that what u want?
Reply
#5

Yes but for for every player with /lastkill [ID] and than <Killer> has killed <Name>
and /lastdeath [ID] <User> was killed from <Killer>
Reply
#6

pawn Код:
lastkillid[MAX_PLAYERS];
OnPlayerDeath

pawn Код:
lastkillid[playerid] = killerid;
pawn Код:
CMD:lastdeath(playerid, params[])
{
new string[128];
new ID;
if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"USAGE: /lastkill <PlayerName/ID>");
format(string,sizeof(string),"%s(%d) was killed by %s(%d)",GetName(ID),ID,GetName(lastkillid),lastkillid);
SendClientMessage(playerid, -1, string);
return 1;
}
That what u want?
Reply
#7

Yes and with /lastkill too
Reply
#8

pawn Код:
lastdeathid[MAX_PLAYERS];
lastkillid[MAX_PLAYERS];
Onplayerdeath

pawn Код:
lastdeathid[killerid] = playerid;
lastkillid[playerid] = killerid;
pawn Код:
CMD:lastdeath(playerid, params[])
{
new string[128];
new ID;
if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"USAGE: /lastkill <PlayerName/ID>");
format(string,sizeof(string),"%s(%d) was killed by %s(%d)",GetName(ID),ID,GetName(lastkillid),lastkillid);
SendClientMessage(playerid, -1, string);
return 1;
}

CMD:lastkill(playerid, params[])
{
new string[128];
new ID;
if(sscanf(params,"u", ID)) return SendClientMessage(playerid,-1,"USAGE: /lastkill <PlayerName/ID>");
format(string,sizeof(string),"%s(%d) has killed %s(%d)",GetName(ID),ID,GetName(lastdeathid),lastdeathid);
SendClientMessage(playerid, -1, string);
return 1;
}
Reply
#9

Can you do it with strcmp and the adminvar is
if(PlayerInfo[playerid][pAdmin] >= 1337) please?
Reply
#10

i am not good at strcmp buy ill give it a try

and why are u still using strcmp when theres zcmd and ycmd etc..

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/lastkill", true, 9))
    {
        new string[128];
        new ID;
        if(PlayerInfo[playerid][pAdmin] >= 1337) return SendClientMessage(playerid,-1,"You are not high enough to use this command");
        if(!sscanf(cmdtext[10], "u", ID))
        {
            format(string,sizeof(string),"%s(%d) was killed by %s(%d)",GetName(ID),ID,GetName(lastkillid),lastkillid);
            SendClientMessage(playerid, -1, string);
            return 1;
        }
        SendClientMessage(playerid, -1, "USAGE: /Example <PlayerName/ID>");
        return 1;
    }

    return 0;
}
same goes for the lastdeath
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)