SA-MP Forums Archive
[NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! (/showthread.php?tid=102231)



[NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - Tigerbeast11 - 14.10.2009

Hey, here is the code...

Код:
public OnPlayerDeath(playerid, killerid, reason)
{
 SendDeathMessage(killerid, playerid, reason);

        if(killerid == INVALID_PLAYER_ID)
        {
          if(PlayerKills[playerid] >= 3 && PlayerKills[playerid] <= 14)
          {
        new PlayerName[MAX_PLAYER_NAME],
                string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s killing spree is now over", PlayerName); // also, how can i make it so that it says "%s's killing spree has been ended by %s"?
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid, 750);
      }
      if(PlayerKills[playerid] >= 15 && PlayerKills[playerid] <= 44) {
        new PlayerName[MAX_PLAYER_NAME],
                string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s killing spree is now over", PlayerName);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid, 1500);
      }
      if(PlayerKills[playerid] >= 45)
              {
        new PlayerName[MAX_PLAYER_NAME],
              string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s killing spree is now over", PlayerName);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(killerid, 2500);
        }

        PlayerKills[playerid] = 0; //Set the murdered's kill count to 0
        PlayerKills[killerid]++; //Set the killer's kill count +1

        if(PlayerKills[killerid] == 3)
                 {
        SendClientMessage(playerid, COLOR_YELLOW,"You are now on a killing spree!");
        new PlayerName[MAX_PLAYER_NAME],
                string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s is now on a killing spree", PlayerName);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(playerid, 450);
        }
        if(PlayerKills[killerid] == 15)
                 {
        SendClientMessage(playerid, COLOR_YELLOW,"You have gotten 15 kills! You have received a Minigun!");
        new PlayerName[MAX_PLAYER_NAME],
                string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s has been awarded a Minigun for getting 15 kills!", PlayerName);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerWeapon(playerid, 38, 3000);
                GivePlayerMoney(playerid, 1500);
        }
        if(PlayerKills[killerid] == 45)
                {
                SendClientMessage(playerid, COLOR_YELLOW,"You have gotten 45 kills! You can now use /shop and /godcar!");
        new PlayerName[MAX_PLAYER_NAME],
                string[128];
                GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
                format(string, sizeof(string), "[Spree]%s has gotten 45 kills and is now able to access /godcar and /shop", PlayerName);
                SendClientMessageToAll(COLOR_YELLOW, string);
                GivePlayerMoney(playerid,1000);
        }
        }
    return 1;
}
Problem is... insted of saying... "Player1 is on a killing spree" it says, "Player2 is on a killing spree" Instead of the killers name, it says the player name of the person who is being killed. Plz help me fix this problem. Also, GivePlayerWeapon(playerid, 38, 3000); gives the player the weapon and not the killer...


Plz help

Greetz =]

P.S How can i make it so that it says, "%s has ended %s's killing spree"


Re: [NEED HELP! CONFUSING PROBLEM!] OnPlayerDeath! - yom - 14.10.2009

playerid is the player who get killed, and that's what you use in GetPlayerName and GivePlayerWeapon, so replace it obviously by killerid, the player who killed playerid.


Re: [NEED HELP! CONFUSING PROBLEM!] OnPlayerDeath! - Tigerbeast11 - 14.10.2009

ok, i understand that, but what about the p.s


Re: [NEED HELP! CONFUSING PROBLEM!] OnPlayerDeath! - Tigerbeast11 - 14.10.2009

Quote:

P.S How can i make it so that it says, "%s has ended %s's killing spree"

Anyone??


Re: [NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - Tigerbeast11 - 14.10.2009

How can i make this so it says, "%s has ended %s's killing spree"


Re: [NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - yom - 14.10.2009

if (IsOnKillingSpree(playerid))
format(string, sizeof(string), "%s has ended %s's killing spree", KillerName, PlayerName);


Re: [NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - Tigerbeast11 - 14.10.2009

doesnt help! cuz pawno dont know when im on a killing spree...


Re: [NEED SERIOUS HELP WITH CONFUSING PROBLEM!] OnPlayerDeath! - Woet - 14.10.2009

'Something like '------------>HELP PLZ FAST NOW HELP!!!!!!!!!!!<----------' is not very descriptive and very annoying.'
'You can bump topics when the last reply is at least 12 hours old.'