PDA

View Full Version : how to detect deagle killer


severance
20/08/2018, 10:14 AM
How to detect if a player killed 5 players with deagle?

KinderClans
20/08/2018, 10:21 AM
new PlayersKilled[MAX_PLAYERS];

OnPlayerDeath:


new weaponid = GetPlayerWeapon(killerid);
if (weaponid == 24) PlayersKilled[killerid] ++;
CheckDeagleKills(killerid);


stock CheckDeagleKills(playerid)
{
if (PlayersKilled[playerid] == 5) SendClientMessage(playerid, -1, "* Killed 5 players with deagle.");
return 1;
}

Sew_Sumi
20/08/2018, 10:37 AM
That's bad..... Like, bad....


new DKs[MAX_PLAYERS];

public OnPlayerDeath(playerid,killerid,reason)
{
if(killerid!=INVALID_PLAYER_ID&&reason==24)
{
DKs[killerid]++;
if(DKs[killerid]>=5)
{
new 5DKmsg[80]
format(5DKmsg,sizeof(5DKmsg), "*** %s has got 5 Desert Eagle Kills ***", GetPlayerName(killerid));
SendMessageToAll(-1, 5DKmsg);
DKs[killerid]=0;
}
}
return 1;
}

public OnPlayerConnect(playerid)
{
DKs[playerid]=0;
return 1;
}

KinderClans
20/08/2018, 10:44 AM
Well yeah, mine it was a draft.

Sew_Sumi
20/08/2018, 10:46 AM
Mine's the same, just knocked it out in the message window.