SA-MP Forums Archive
Need Help in my gamemode Please - 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)
+--- Thread: Need Help in my gamemode Please (/showthread.php?tid=333908)



Need Help in my gamemode Please - [GF]Logic - 13.04.2012

Okay i am working on a TDM Gamemode anyway i followed a tutorial to make a killer streak but i got errors i can't fix here is the command
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid) &&  killerid != INVALID_PLAYER_ID ) {
        if(GetPlayerWantedLevel(killerid) < 6)
          {
            SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
          }
            Streaks[killerid] ++;
            GivePlayerMoney(killerid, 500);
          }
            SetPlayerWantedLevel(playerid, 0);
            Streaks[playerid] = 0;
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
            new str[ 256 ], KillerName[MAX_PLAYER_NAME];
            GetPlayerName(killerid, KillerName, sizeof(KillerName));
            switch(Streaks[killerid])
            {
                case 2:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~g~%s has performed a ~y~double kill!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 3:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~y~Triple Kill for ~b~%s!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 4:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~p~Quadro Kill for ~r~%s!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 5:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~r~%s is dominating with ~p~five kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 6:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~w~%s is godlike with ~y~six kills!", KillerName);
                        GameTextForAll(str,4000,4);
                }
                case 7:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~r~RAMPAGE for %s with ~w~seven kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 8:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~p~%s is unbelievable with ~y~eight kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 9:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~g~%s is worldclass, ~b~nine kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 10:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~b~%s is annihilating with ~g~ten kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
    return 1;
}
Errors :
Quote:

C:\Documents and Settings\Solution_\Desktop\Windows Sa-mp Server\gamemodes\TDM.pwn(124) : warning 217: loose indentation
C:\Documents and Settings\Solution_\Desktop\Windows Sa-mp Server\gamemodes\TDM.pwn(127) : warning 217: loose indentation
C:\Documents and Settings\Solution_\Desktop\Windows Sa-mp Server\gamemodes\TDM.pwn(157) : warning 217: loose indentation
C:\Documents and Settings\Solution_\Desktop\Windows Sa-mp Server\gamemodes\TDM.pwn(179) : error 002: only a single statement (or expression) can follow each "case"
C:\Documents and Settings\Solution_\Desktop\Windows Sa-mp Server\gamemodes\TDM.pwn(179) : warning 215: expression has no effect




Re: Need Help in my gamemode Please - DBan - 13.04.2012

It will be much easier for us to help you if you identify the lines that give out the error...


Re: Need Help in my gamemode Please - [GF]Logic - 13.04.2012

Streaks[killerid] ++; line 124

SetPlayerWantedLevel(playerid, 0); line 127

return 1; line 179

fixed the 157 line


Re: Need Help in my gamemode Please - Faisal_khan - 13.04.2012

You were missing a bracket there bro try this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(IsPlayerConnected(killerid) &&  killerid != INVALID_PLAYER_ID )
          {
            if(GetPlayerWantedLevel(killerid) < 6)
              {
                SetPlayerWantedLevel(killerid, GetPlayerWantedLevel(killerid) + 1);
              }
            Streaks[killerid] ++;
            GivePlayerMoney(killerid, 500);
          }
            SetPlayerWantedLevel(playerid, 0);
            Streaks[playerid] = 0;
            SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
            new str[ 256 ], KillerName[MAX_PLAYER_NAME];
            GetPlayerName(killerid, KillerName, sizeof(KillerName));
            switch(Streaks[killerid])
            {
                case 2:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~g~%s has performed a ~y~double kill!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 3:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~y~Triple Kill for ~b~%s!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 4:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~p~Quadro Kill for ~r~%s!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 5:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~r~%s is dominating with ~p~five kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 6:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~w~%s is godlike with ~y~six kills!", KillerName);
                        GameTextForAll(str,4000,4);
                }
                case 7:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~r~RAMPAGE for %s with ~w~seven kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 8:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~p~%s is unbelievable with ~y~eight kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 9:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~g~%s is worldclass, ~b~nine kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
                case 10:
                {
                    format(str, sizeof(str), "[KILLINGSPREE] ~b~%s is annihilating with ~g~ten kills!", KillerName);
                    GameTextForAll(str,4000,4);
                }
            }//here is the missing bracket
    return 1;
}