SA-MP Forums Archive
Simple Errors:P - Forgot how to make them lol. - 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: Simple Errors:P - Forgot how to make them lol. (/showthread.php?tid=307635)



Simple Errors:P - Forgot how to make them lol. - PlayHard - 31.12.2011

So um I have this command:

pawn Код:
YCMD:buynitro(playerid, params[])
{
    if(IsPlayerDriver(playerid)) else return SCM(playerid, COLOR_GREY, "You're not in a vehicle");
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, -216.4033,1048.0056,19.7422)) else return SCM(playerid, COLOR_GREY, "You're not at Nitrous Shop");
        {
            if(PlayerInfo[playerid][VehNitro] == 0) else return SCM(playerid, COLOR_GREY, "You already have Nitrous in your vehicle.");
            {
                PlayerInfo[playerid][VehNitro] = 1;
            }
        }
    }
    return 1;
}
I am sure that there is something wrong with the " else return " after every function there, so I forgot how to make them, Can you fix that for me please?

Error log:

pawn Код:
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2417) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2417) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2417) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2418) : warning 225: unreachable code
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2419) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2419) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2419) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2420) : warning 225: unreachable code
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2421) : error 029: invalid expression, assumed zero
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2421) : warning 215: expression has no effect
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2421) : error 001: expected token: ";", but found "return"
C:\Documents and Settings\Administrator\My Documents\Downloads\samp03dsvr_R2_win32\gamemodes\bc.pwn(2422) : warning 225: unreachable code
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


6 Errors.



Re: Simple Errors:P - Forgot how to make them lol. - CoaPsyFactor - 31.12.2011

remove else return, leave just return there


Re: Simple Errors:P - Forgot how to make them lol. - James Coral - 31.12.2011

show the line


Re: Simple Errors:P - Forgot how to make them lol. - FireCat - 31.12.2011

Hmm never made it like you did, just try it like this:
pawn Код:
YCMD:buynitro(playerid, params[])
{
    if(IsPlayerDriver(playerid))
    {
        if(IsPlayerInRangeOfPoint(playerid, 7.0, -216.4033,1048.0056,19.7422))
        {
            if(PlayerInfo[playerid][VehNitro] == 0)
            {
                PlayerInfo[playerid][VehNitro] = 1;
        return 1;
            }
        else return SCM(playerid, COLOR_GREY, "You already have Nitrous in your vehicle.");
        }
    else return SCM(playerid, COLOR_GREY, "You're not at Nitrous Shop");   
    }
    else return SCM(playerid, COLOR_GREY, "You're not in a vehicle");      
}



Re: Simple Errors:P - Forgot how to make them lol. - Ash. - 31.12.2011

Quote:
Originally Posted by James Coral
Посмотреть сообщение
show the line
He quite clearly stated "else return" as the identifying line. Please learn to read.

OT: FireCat's [should] will work.

:: "This forum requires that you wait 120 seconds between posts. Please try again in 1 seconds.", just mean Mr. Forum!


Re: Simple Errors:P - Forgot how to make them lol. - Mike_Peterson - 31.12.2011

Fixed over teamviewer by me..


Re: Simple Errors:P - Forgot how to make them lol. - PlayHard - 31.12.2011

@FireCat: Yeah I used to make it like that, but I want a simple and modern way . Thank you :3.
@Mike: Thank you buddy <3.