#4

PHP код:
if(GetPVarInt(playerid"ChoosingDrugs") == 1
    { 
        if(
strcmp("pot"texttrue) == 0
        { 
            new 
mypoint = -1
            for (new 
i=0i<MAX_POINTSi++) 
            { 
                if(
IsPlayerInRangeOfPoint(playerid3.0Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]) && strcmp(Points[i][Name], "Drug Factory"true) == 0
                { 
                    
mypoint i
                } 
            } 
            if(
mypoint == -1
            { 
                
SendClientMessage(playeridCOLOR_GREY"You're not at the Drug Factory!"); 
                return 
0
            } 
            if(
PlayerInfo[playerid][pCrates]) 
            { 
                
SendClientMessage(playeridCOLOR_GREY"   You can't hold any more Drug Crates!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
             if(
CheckPointCheck(playerid)) 
             { 
                  
SendClientMessage(playeridCOLOR_WHITE"Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint)."); 
                return 
0
              } 
            if(
GetPlayerCash(playerid) >= 100
            { 
                
SendClientMessage(playeridCOLOR_LIGHTBLUE,"* You bought some Drug Crates for $100."); 
                
GivePlayerCash(playerid, -100); 
                
PlayerInfo[playerid][pCrates] = 1
                
SetPVarInt(playerid"CrateDeliver"1); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                
SetPVarInt(playerid"tpDrugRunTimer"25); 
                
SetTimerEx("OtherTimerEx"1000false"ii"playeridTYPE_TPDRUGRUNTIMER); 
                
SetPlayerCheckpoint(playerid2166.3772,-1675.3829,15.08593); 
                for(new 
0sizeof(FamilyInfo); i++) 
                { 
                    if(
strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0
                    { 
                        
FamilyInfo[i][FamilyBank] += 500
                    } 
                } 
                return 
0
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY," You can't afford the $100!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
        } 
        else if(
strcmp("crack"texttrue) == 0
        { 
            new 
mypoint = -1
            for (new 
i=0i<MAX_POINTSi++) 
            { 
                if(
IsPlayerInRangeOfPoint(playerid3.0Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]) && strcmp(Points[i][Name], "Drug Factory"true) == 0
                { 
                    
mypoint i
                } 
            } 
            if(
mypoint == -1
            { 
                
SendClientMessage(playeridCOLOR_GREY"You're not at the Drug Factory!"); 
                return 
0
            } 
            if(
PlayerInfo[playerid][pCrates]) 
            { 
                
SendClientMessage(playeridCOLOR_GREY"   You can't hold any more drug crates!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
             if(
CheckPointCheck(playerid)) 
             { 
                  
SendClientMessage(playeridCOLOR_WHITE"Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint)."); 
                return 
0
              } 
              if(
GetPlayerCash(playerid) >= 100
            { 
                
SendClientMessage(playeridCOLOR_LIGHTBLUE,"* You bought some drug crates for $100."); 
                
GivePlayerCash(playerid, -100); 
                
PlayerInfo[playerid][pCrates] = 1
                
SetPVarInt(playerid"CrateDeliver"2); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                
SetPVarInt(playerid"tpDrugRunTimer"25); 
                
SetTimerEx("OtherTimerEx"1000false"ii"playeridTYPE_TPDRUGRUNTIMER); 
                
SetPlayerCheckpoint(playerid2354.2808,-1169.2959,28.00663); 
                for(new 
0sizeof(FamilyInfo); i++) 
                { 
                    if(
strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0
                    { 
                        
FamilyInfo[i][FamilyBank] += 50
                    } 
                } 
                return 
0
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY," You can't afford the $100!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
        } 
        else if(
strcmp("chemicals"texttrue) == 0
        { 
            new 
mypoint = -1
            for (new 
i=0i<MAX_POINTSi++) 
            { 
                if(
IsPlayerInRangeOfPoint(playerid3.0Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]) && strcmp(Points[i][Name], "Drug Factory"true) == 0
                { 
                    
mypoint i
                } 
            } 
            if(
mypoint == -1
            { 
                
SendClientMessage(playeridCOLOR_GREY"You're not at the Drug Factory!"); 
                return 
0
            } 
            if(
PlayerInfo[playerid][pCrates]) 
            { 
                
SendClientMessage(playeridCOLOR_GREY"   You can't hold any more drug crates!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
             if(
CheckPointCheck(playerid)) 
             { 
                  
SendClientMessage(playeridCOLOR_WHITE"Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint)."); 
                return 
0
              } 
              if(
GetPlayerCash(playerid) >= 100
            { 
                
SendClientMessage(playeridCOLOR_LIGHTBLUE,"* You bought some drug crates for $100."); 
                
GivePlayerCash(playerid, -100); 
                
PlayerInfo[playerid][pCrates] = 1
                
SetPVarInt(playerid"CrateDeliver"3); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                
SetPVarInt(playerid"tpDrugRunTimer"25); 
                
SetTimerEx("OtherTimerEx"1000false"ii"playeridTYPE_TPDRUGRUNTIMER); 
                
SetPlayerCheckpoint(playerid2354.2808,-1169.2959,28.00663); 
                for(new 
0sizeof(FamilyInfo); i++) 
                { 
                    if(
strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0
                    { 
                        
FamilyInfo[i][FamilyBank] += 50
                    } 
                } 
                return 
0
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY," You can't afford the $100!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
        } 
        else 
        { 
             
SendClientMessageEx(playeridCOLOR_LIGHTRED,"What type of drugs would you like to smuggle? Type 'crack, pot or chemicals'."); 
            return 
0
        } 
    } 
I saw the problem.
It was unreachable because it was behind an else which should have been the end of if else statements

PHP код:
else // This else
        

             
SendClientMessageEx(playeridCOLOR_LIGHTRED,"What type of drugs would you like to smuggle? Type 'crack, pot or chemicals'."); 
            return 
0
        } 
         
        else if(
strcmp("chemicals"texttrue) == 0
        { 
            new 
mypoint = -1
            for (new 
i=0i<MAX_POINTSi++) 
            { 
                if(
IsPlayerInRangeOfPoint(playerid3.0Points[i][Pointx], Points[i][Pointy], Points[i][Pointz]) && strcmp(Points[i][Name], "Drug Factory"true) == 0
                { 
                    
mypoint i
                } 
            } 
            if(
mypoint == -1
            { 
                
SendClientMessage(playeridCOLOR_GREY"You're not at the Drug Factory!"); 
                return 
0
            } 
            if(
PlayerInfo[playerid][pCrates]) 
            { 
                
SendClientMessage(playeridCOLOR_GREY"   You can't hold any more drug crates!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
             if(
CheckPointCheck(playerid)) 
             { 
                  
SendClientMessage(playeridCOLOR_WHITE"Please ensure that your current checkpoint is destroyed first (you either have material packages, or another existing checkpoint)."); 
                return 
0
              } 
              if(
GetPlayerCash(playerid) >= 100
            { 
                
SendClientMessage(playeridCOLOR_LIGHTBLUE,"* You bought some drug crates for $100."); 
                
GivePlayerCash(playerid, -100); 
                
PlayerInfo[playerid][pCrates] = 1
                
SetPVarInt(playerid"CrateDeliver"3); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                
SetPVarInt(playerid"tpDrugRunTimer"25); 
                
SetTimerEx("OtherTimerEx"1000false"ii"playeridTYPE_TPDRUGRUNTIMER); 
                
SetPlayerCheckpoint(playerid2354.2808,-1169.2959,28.00663); 
                for(new 
0sizeof(FamilyInfo); i++) 
                { 
                    if(
strcmp(Points[mypoint][Owner], FamilyInfo[i][FamilyName], true) == 0
                    { 
                        
FamilyInfo[i][FamilyBank] += 50
                    } 
                } 
                return 
0
            } 
            else 
            { 
                
SendClientMessage(playeridCOLOR_GREY," You can't afford the $100!"); 
                
SetPVarInt(playerid"ChoosingDrugs"0); 
                return 
0
            } 
        } 
        else 
        { 
             
SendClientMessageEx(playeridCOLOR_LIGHTRED,"What type of drugs would you like to smuggle? Type 'crack, pot or chemicals'."); 
            return 
0
        } 
The first snippet I passed is the corrected one although I am not sure if it does work since I didn't test it, I just exchanged it.
Reply


Messages In This Thread
Help - by TitoRayne - 17.04.2018, 14:32
Re: Help - by Rocket16 - 17.04.2018, 14:41
Re: Help - by TitoRayne - 17.04.2018, 14:42
Re: Help - by JesterlJoker - 17.04.2018, 14:48
Re: Help - by TitoRayne - 17.04.2018, 14:53
Re: Help - by JesterlJoker - 17.04.2018, 14:55
Re: Help - by TitoRayne - 17.04.2018, 14:57
Re: Help - by JesterlJoker - 17.04.2018, 15:12
Re: Help - by TitoRayne - 17.04.2018, 15:20
Re: Help - by JesterlJoker - 17.04.2018, 15:24

Forum Jump:


Users browsing this thread: 2 Guest(s)