error 029: invalid expression, assumed zero
#1

How to fix this!?!

PHP код:
error 029invalid expressionassumed zero 
PHP код:
public OnPlayerKeyStateChange(playeridnewkeysoldkeys)
{
    if(
PRESSED(KEY_LOOK_BEHIND))
    
GetPlayerState(playerid);
    {
        if(
GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
        {
            if(
GetPlayerMoney(playerid) <500) return SendClientMessage(playerid,0xAA3333AA"Sorry, you dont have the money. [Cost 500$]!");
            
SendClientMessage(playerid,0xAA3333AA"[Reparied]:Your vehicle health is now 100%.");
            
GivePlayerMoney(playerid,-500);
               
RepairVehicle(GetPlayerVehicleID(playerid));
               
SetVehicleHealth(playerid100);
        }
        if(
GetPlayerState(playerid) != PLAYER_STATE_ONFOOT))
        {
            
PutPlayerInVehicle(playeridInfernus[7], 0);
            
SendClientMessage(playeridGrey"You have been Respawned.");
        }
    }
    return 
1;

Reply
#2

Usually represents overuse of closing brackets remove one of the } above return 1;.
Reply
#3

The errors line is: if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)) + if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
Reply
#4

Change Them to :

Код:
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
Reply
#5

Hol' up.. you got that messed up,
GetPlayerState(playerid); < this is useless remove it.
change if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER))
To: if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
And if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT))
To : if(GetPlayerState(playerid) == PLAYER_STATE_ONFOOT)
i think you got the concept wrong, != (means unequal to) you made if the player is NOT in a vehicle, repair his nonexisting vehicle, same for onfoot statement, fix that.
The reason you got an error is cause you put at the end of the if statement )) when you only needed one )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)