1 Error Invalid expression, assumed zero, Help here please.
#1

Hey i am trying to make an command for rcon admin, to reset all vehicles.

So here is 1 error, i don't know how to fix it, So i may need your help.

Error:-

pawn Код:
C:\Users\Davz\Desktop\Dadmin.pwn(48) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Error.
Code:-

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Resetvehicles", cmdtext) == 0)
    {
        if(IsPlayerAdmin(playerid)) SendClientMessageToAll(0xFFFF00AA, "An Admin has reseted all vehicles.");
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            SetVehicleToRespawn(i);
        }
        else SendClientMessage(playerid, 0xFFFF00AA, "You're not an admin");
        return 1;
    }
    return 0;
}
Reply
#2

Bump, anyone
Reply
#3

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Resetvehicles", cmdtext) == 0)
    {
        if(IsPlayerAdmin(playerid)) {
            SendClientMessageToAll(0xFFFF00AA, "An Admin has reseted all vehicles.");
            for(new i = 0; i < MAX_VEHICLES; i++) {
                SetVehicleToRespawn(i);
            }
        }
        else {
            SendClientMessage(playerid, 0xFFFF00AA, "You're not an admin");
        }
        return 1;
    }
    return 0;
}
Add your curly braces properly and don't just try add braces in silly places. This code will work.
Reply
#4

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/Resetvehicles", cmdtext) == 0)
    {
        if(!IsPlayerAdmin(playerid)) Return SendClientMessage(playerid, 0xFFFF00AA, "You're not an admin");
        for(new i = 0; i < MAX_VEHICLES; i++)
        {
            SetVehicleToRespawn(i);
        }
        SendClientMessage(playerid, 0xFFFF00AA, "You're not an admin");
        return 1;
    }
    return 0;
}
?

Edit: Too late ^^"
Reply
#5

No, that check is SUPPOSED to check if the player is an admin but the OP clearly doesn't know how to use curly braces properly yet.
Reply
#6

Thanks you both!

You helped me out.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)