open.mp forum
[Pawn] ask dm - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] ask dm (/showthread.php?tid=1213)



ask dm - nbx2000 - 2020-10-05

How can I do a simple kill spree? streak some example


RE: ask dm - Worm - 2020-10-08

Create a counter for the player.

Increase that counter by 1 each time a player dies.



Code:
playerkills = 0



public OnPlayerDeath(playerid, killerid, reason)

{

PlayerInfo[playerid][playerkills] = 0; //Resets the player kills back to 0 after death



PlayerInfo[killerid][playerkills]; //Increases the killer kills by 1



return 1;

}



RE: ask dm - Expert* - 2020-10-15

Check if killerid is a real player. And if reason is valid.



Quote:killerid The ID of the player that killed the player who died, or INVALID_PLAYER_ID if there was none.



https://www.open.mp/docs/scripting/callbacks/OnPlayerDeath


RE: ask dm - nbx2000 - 2020-10-16

Is this correct? is the stock for the name ok? pname

Code:
public OnPlayerDeath(playerid, killerid, reason)

{

? ? new string[128];

? ? KillSpree[playerid] = 0;

? ? if(killerid!=INVALID_PLAYER_ID)

? ? {

switch(KillSpree[killerid])

{

? ? case 4:

{



? format(string, sizeof(string), "*%s Dominating with %d Kills", pname, KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 6:

{



format(string, sizeof(string), "*%s Rampage with %d Kills", pname, KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 8:

{



format(string, sizeof(string), "*%s Killing Spree with %d Kills", pname, KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 10:

{



format(string, sizeof(string), "*%s Monster Kill with %d Kills", pname, KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 12:

{



format(string, sizeof(string), "*%s Unstoppable with %d Kills", pname, KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 14:

{



format(string, sizeof(string), "*%s Ultra Kill with %d Kills", pname, KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 16:

{



format(string, sizeof(string), "*%s Godlike with %d Kills", pname, KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 18:

{



? format(string, sizeof(string), "*%s Wicked Sick with %d Kills", pname, KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 20:

{



format(string, sizeof(string), "*%s Ludacriss Kill with %d Kills", pname, KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 22:

{



format(string, sizeof(string), "*%s Holy Shit with %d Kills", pname, KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

}



stock pname(playerid)

{

? new plname[MAX_PLAYER_NAME];

? GetPlayerName(playerid, plname, sizeof(plname));

? return plname;

}



RE: ask dm - Worm - 2020-10-16

You didn't increase the count for the player each time he receives a kill.



Code:
public OnPlayerDeath(playerid, killerid, reason)

{

? ? new string[128];

? ? KillSpree[playerid] = 0;

? ? if(killerid!=INVALID_PLAYER_ID)

? ? {

? ? ? ? ? KillSpree[killerid] ;

switch(KillSpree[killerid])

{

? ? case 4:

{



? format(string, sizeof(string), "*%s Dominating with %d Kills", pname(killerid), KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 6:

{



format(string, sizeof(string), "*%s Rampage with %d Kills", pname(killerid), KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 8:

{



format(string, sizeof(string), "*%s Killing Spree with %d Kills", pname(killerid), KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 10:

{



format(string, sizeof(string), "*%s Monster Kill with %d Kills", pname(killerid), KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 12:

{



format(string, sizeof(string), "*%s Unstoppable with %d Kills", pname(killerid), KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 14:

{



format(string, sizeof(string), "*%s Ultra Kill with %d Kills", pname(killerid), KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 16:

{



format(string, sizeof(string), "*%s Godlike with %d Kills", pname(killerid), KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 18:

{



? format(string, sizeof(string), "*%s Wicked Sick with %d Kills", pname(killerid), KillSpree[killerid]);

? SendClientMessageToAll(COLOR_ORANGE, string);

}

case 20:

{



format(string, sizeof(string), "*%s Ludacriss Kill with %d Kills", pname(killerid), KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

case 22:

{



format(string, sizeof(string), "*%s Holy Shit with %d Kills", pname(killerid), KillSpree[killerid]);

SendClientMessageToAll(COLOR_ORANGE, string);

}

}



stock pname(playerid)

{

? new plname[MAX_PLAYER_NAME];

? GetPlayerName(playerid, plname, sizeof(plname));

? return plname;

}



That should work.