SA-MP Forums Archive
[SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - 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: [SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] (/showthread.php?tid=102124)



[SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - Tigerbeast11 - 13.10.2009

I have this function which wont work! It compiles but doesnt do what its meant to!!!! plz help me!!!!

Код:
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);
                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;
}



Re: [SERIOUS PROBLEM] Function not Working!!!! - (.Aztec); - 13.10.2009

Well, what does it do?


Re: [SERIOUS PROBLEM] Function not Working!!!! - Tigerbeast11 - 13.10.2009

If you get 3 kills, it should send a message to everyone saying your on a killing spree, and it should give u $450

If you get 15 kills, it should send a messsage saying you have a minigun to everyone, it should give you a minigun, and $1500

If you get 45 kills, you are allowed to use /shop (menu), and /godcar and you get $1000 and a message to everyone saying "%s has 45 kills and can now access the /shop menu and /godcar" (or summthing)


Re: [SERIOUS PROBLEM] Function not Working!!!! - (.Aztec); - 13.10.2009

I know that, but what does it do that you don't want it to do?


Re: [SERIOUS PROBLEM] Function not Working!!!! - Tigerbeast11 - 13.10.2009

One more thing, if u had more than 3 kills and you die, a message goes to everyone saying "%s has ended %s's killing spree" and killer should get money!


Re: [SERIOUS PROBLEM] Function not Working!!!! - Tigerbeast11 - 13.10.2009

Quote:
Originally Posted by sizeof(Sky));
I know that, but what does it do that you don't want it to do?
It doesnt do anything!!!


Re: [SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - (.Aztec); - 13.10.2009

Hmm, I haven't tested this, nor compiled it... but it should work. (note: i just typed in in SMF so it's not very good indentation..)

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
  new PlayerName[MAX_PLAYER_NAME],string[128];
    if(killerid == INVALID_PLAYER_ID)
    {
        if(PlayerKills[playerid] >= 3 && PlayerKills[playerid] <= 14)
        {
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
            format(string, sizeof(string), "[Spree]%s killing spree is now over", PlayerName);
            SendClientMessageToAll(COLOR_YELLOW, string);
        GivePlayerMoney(killerid, 750);
        }
    if(PlayerKills[playerid] >= 15 && PlayerKills[playerid] <= 44)
    {
        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)
         {
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        format(string, sizeof(string), "[Spree]%s killing spree is now over", PlayerName);
        SendClientMessageToAll(COLOR_YELLOW, string);
        GivePlayerMoney(killerid, 2500);
        }
        if(PlayerKills[killerid] == 3)
        {
        SendClientMessage(playerid, COLOR_YELLOW,"You are now on a killing spree!");
        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!");
            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!");
        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);
     }
  }
    PlayerKills[killerid]++;
        PlayerKills[playerid] = 0;
    return 1;
}



Re: [SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - Tigerbeast11 - 13.10.2009

Does it work? It already used to compile, but it never did anything!


Re: [SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - Tigerbeast11 - 13.10.2009

Quote:
Originally Posted by Tigerbeast11
Does it work? It already used to compile, but it never did anything!
Just tested it, it compiles, but doesnt work, just like before!


Is there any other way to put this...


Re: [SERIOUS PROBLEM] Function not Working!!!![NEED SERIOUS HELP!] - (.Aztec); - 13.10.2009

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by Tigerbeast11
Does it work? It already used to compile, but it never did anything!
Just tested it, it compiles, but doesnt work, just like before!


Is there any other way to put this...
Hmm.. I really have no idea, try re-writing it.