Burgershot
  • Home
  • Members
  • Team
  • Help
  • Search
  • Register
  • Login
  • Home
  • Members
  • Help
  • Search
Burgershot SA-MP Pawn Scripting [Pawn] ask dm

 
  • 0 Vote(s) - 0 Average
Pawn ask dm
nbx2000
Offline

Burgershot Member
Posts: 14
Threads: 7
Joined: May 2019
Reputation: 0
Location: argentina
#1
2020-10-05, 05:38 AM
How can I do a simple kill spree? streak some example
Worm
Offline

Burgershot Member
Posts: 20
Threads: 0
Joined: Oct 2020
Reputation: 0
#2
2020-10-08, 01:51 PM
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;
}
Expert*
Offline

Burgershot Member
Posts: 61
Threads: 2
Joined: Apr 2019
Reputation: 4
#3
2020-10-15, 01:54 PM
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
nbx2000
Offline

Burgershot Member
Posts: 14
Threads: 7
Joined: May 2019
Reputation: 0
Location: argentina
#4
2020-10-16, 06:09 AM
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;
}
Worm
Offline

Burgershot Member
Posts: 20
Threads: 0
Joined: Oct 2020
Reputation: 0
#5
2020-10-16, 10:38 AM
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.
« Next Oldest | Next Newest »



  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Burgershot - Powered by our Community and MyBB Original Theme by Emerald

Linear Mode
Threaded Mode