PDA

View Full Version : Simple Errors:P - Forgot how to make them lol.


PlayHard
31/12/2011, 11:40 AM
So um I have this command:

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:

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.

CoaPsyFactor
31/12/2011, 11:41 AM
remove else return, leave just return there :D

James Coral
31/12/2011, 11:42 AM
show the line

FireCat
31/12/2011, 11:44 AM
Hmm never made it like you did, just try it like this:

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");
}

Ash.
31/12/2011, 11:45 AM
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!

Mike_Peterson
31/12/2011, 11:45 AM
Fixed over teamviewer by me..

PlayHard
31/12/2011, 11:57 AM
@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.