Unreachable code
#1

Hello i have problem ....

PHP код:
stock buycarscore(playerid){
    if((
PlayerInfo[playerid][vowner] == 0) && (GetPlayerScore(playerid) > 100)){
        
buycar(playerid);
        return 
1;
    }else return 
SendClientMessage(playeridCOLOR_BRIGHTRED"You score must be 100+ to buy vehicle!");    
    if((
PlayerInfo[playerid][vowner] == 1) && (GetPlayerScore(playerid) < 300)){
        
buycar(playerid);
        return 
1;
    }else return 
SendClientMessage(playeridCOLOR_BRIGHTRED"You score must be 100+ to buy vehicle!"); 
it coninues...

PHP код:
smog.pwn(19375) : warning 225unreachable code
smog
.pwn(19380) : warning 225unreachable code
smog
.pwn(19385) : warning 225unreachable code
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase 
Reply
#2

Hi your problem is that you are either returning one thing or another with your if/else statement, easy fix.

basically you have to return nothing if you are going to continue checking things with if/else statements
in the else part

pawn Код:
stock buycarscore(playerid){
if((PlayerInfo[playerid][vowner] == 0) && (GetPlayerScore(playerid) > 100)){
    buycar(playerid);
    return 1;
}else /*return*/SendClientMessage(playerid, COLOR_BRIGHTRED, "You score must be 100+ to buy vehicle!");    

if((PlayerInfo[playerid][vowner] == 1) && (GetPlayerScore(playerid) < 300)){
    buycar(playerid);
    return 1;
}else /*return*/SendClientMessage(playerid, COLOR_BRIGHTRED, "You score must be 100+ to buy vehicle!");

//commented out the mistakes you did.
Reply
#3

thanks it cobiled.

but it wont work ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)