SA-MP Forums Archive
Code error: else return - 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: Code error: else return (/showthread.php?tid=426147)



Code error: else return - LeeXian99 - 28.03.2013

Well well, I don't know how to fix it. :c

pawn Код:
CMD:boost(playerid,params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(EnableBoast[playerid])
        {
            EnableBoast[playerid] = 0; //will disable boast
            SendClientMessage(playerid, 0x924161FF, "[!] Boost Deactivated.");
        }
        else
        {
            EnableBoast[playerid] = 1; //will enable boast
            SendClientMessage(playerid, 0x924161FF, "[!] Boost Activated.");
            SendClientMessage(playerid, 0x00FFFFAA, "Press Fire key for boost.");
            SendClientMessage(playerid, 0x00FFFFAA, "Press H key for bounce.");
        }
    else return SendClientMessage(playerid, red, "You must be in a vehicle to do that!"); //This sentence causes error.
    }
    return 1;
}
Errors:
Код:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5965) : warning 217: loose indentation
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5965) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5965) : warning 215: expression has no effect
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5965) : error 001: expected token: ";", but found "return"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.



Re: Code error: else return - Neil. - 28.03.2013

pawn Код:
CMD:boost(playerid,params[])
{
    if(IsPlayerInAnyVehicle(playerid))
    {
        if(EnableBoast[playerid])
        {
            EnableBoast[playerid] = 0; //will disable boast
            SendClientMessage(playerid, 0x924161FF, "[!] Boost Deactivated.");
        }
        else
        {
            EnableBoast[playerid] = 1; //will enable boast
            SendClientMessage(playerid, 0x924161FF, "[!] Boost Activated.");
            SendClientMessage(playerid, 0x00FFFFAA, "Press Fire key for boost.");
            SendClientMessage(playerid, 0x00FFFFAA, "Press H key for bounce.");
        }
    }
    else return SendClientMessage(playerid, red, "You must be in a vehicle to do that!"); //Fixed
    return 1;
}