[HELP] else problem
#1

Here you can see else:

pawn Код:
else
{
   SendClientMessage(playerid,red,"You can't use this command!");
}
And on this script shows error:

Код:
error 029: invalid expression, assumed zero
How to fix that?

Code:

pawn Код:
new cartype = GetPlayerVehicleID(playerid);
  new State=GetPlayerState(playerid);
  {
    if(GetPVarInt(playerid, "Admin") >= 1)
    {
        if(State!=PLAYER_STATE_DRIVER)
        {
            TogglePlayerControllable(playerid,0); // Freeze the player
            SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
            SetPlayerPos(playerid,-200.9151,61.5312,5.2272);
            GameTextForPlayer(playerid,"~r~Admin base!",2500,1);
            return 1;
        }
        else if(IsPlayerInVehicle(playerid, cartype) == 1)
        {
            TogglePlayerControllable(playerid,0); // Freeze the player
            SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
            SetVehiclePos(cartype,-200.9151,61.5312,5.2272);
            SetVehicleZAngle(cartype,91);
            GameTextForPlayer(playerid,"~r~Admin Base!",2500,1);
            return 1;
        }
        else
        {
            TogglePlayerControllable(playerid,0); // Freeze the player
            SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
            SetPlayerPos(playerid,-200.9151,61.5312,5.2272);
        }
            GameTextForPlayer(playerid,"~r~Admin Base!",2500,1);
            return 1;
        }
    }
    /*else
    {
        SendClientMessage(playerid,red,"You can't use this command!");
    }*/

    return 1;
}
Reply
#2

Why do you open up a bracket here? It messes up with everything.

Код:
new cartype = GetPlayerVehicleID(playerid);
  new State=GetPlayerState(playerid);
  {
Reply
#3

pawn Код:
new cartype = GetPlayerVehicleID(playerid);
        new State=GetPlayerState(playerid);
        if(GetPVarInt(playerid, "Admin") >= 1)
        {
            if(State!=PLAYER_STATE_DRIVER)
            {
                TogglePlayerControllable(playerid,0); // Freeze the player
                SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
                SetPlayerPos(playerid,-200.9151,61.5312,5.2272);
                GameTextForPlayer(playerid,"~r~Admin base!",2500,1);
                return 1;
            }
            else if(IsPlayerInVehicle(playerid, cartype) == 1)
            {
                TogglePlayerControllable(playerid,0); // Freeze the player
                SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
                SetVehiclePos(cartype,-200.9151,61.5312,5.2272);
                SetVehicleZAngle(cartype,91);
                GameTextForPlayer(playerid,"~r~Admin Base!",2500,1);
                return 1;
            }
            else
            {
                TogglePlayerControllable(playerid,0); // Freeze the player
                SetTimerEx("Freeze", 2000, false, "i", playerid); // Timer for 4 seconds (not repeating timer, only called on the command)
                SetPlayerPos(playerid,-200.9151,61.5312,5.2272);
            }
            GameTextForPlayer(playerid,"~r~Admin Base!",2500,1);
        }
        else
        {
            SendClientMessage(playerid,red,"You can't use this command!");
        }
Reply
#4

As CuervO stated you don't need to open a bracket there it's useless.
Reply
#5

Okay, show me a correctly code ://
Reply
#6

Quote:
Originally Posted by V4at
Посмотреть сообщение
Okay, show me a correctly code ://
Try the code that I posted and see if it works. As Cuerv0 stated you missed a bracket there and also another un-needed one near the bottom.
Reply
#7

Something is wrong, if player is admin, he can't also use this command..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)