Invalid Function
#1

Anyone who helps +rep

pawn Код:
if ( newstate == PLAYER_STATE_DRIVER )
            {
                if ( IsAnAirVehicle ( GetPlayerVehicleID ( playerid ) )
                {
                    if (PlayerInfo[playerid][jProfesion] == 1 | PlayerInfo[playerid][jProfesion] == 2 | PlayerInfo[playerid][jProfesion] == 3 | PlayerInfo[playerid][jProfesion] == 4)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You don't know how to drive aircraft vehicles.");
                        return 1;
                    }
                }
            }
If anyone could tell me what's wrong with this that'd be great.
Reply
#2

What error do you get?
Reply
#3

parp.pwn(28607) : error 010: invalid function or declaration
parp.pwn(28609) : error 010: invalid function or declaration
parp.pwn(28611) : error 010: invalid function or declaration
parp.pwn(28615) : error 010: invalid function or declaration

28607 : if ( newstate == PLAYER_STATE_DRIVER )
28609 : if ( IsAnAirVehicle ( GetPlayerVehicleID ( playerid ) )
28611 : if (PlayerInfo[playerid][jProfesion] == 1 | PlayerInfo[playerid][jProfesion] == 2 | PlayerInfo[playerid][jProfesion] == 3 | PlayerInfo[playerid][jProfesion] == 4)

Removed the return 1; but this is the error for it too.
28615 : return 1;
Reply
#4

Could you post the script where you tell the line numbers?
Reply
#5

pawn Код:
28607 if ( newstate == PLAYER_STATE_DRIVER )
28608 {
28609        if ( IsAnAirVehicle ( GetPlayerVehicleID ( playerid ) )
28610        {
28611            if (PlayerInfo[playerid][jProfesion] == 1 | PlayerInfo[playerid][jProfesion] == 2 | PlayerInfo[playerid][jProfesion] == 3 | PlayerInfo[playerid][jProfesion] == 4)
28612            {
28613                RemovePlayerFromVehicle(playerid);
28614                SendClientMessage(playerid,COLOR_RED,"You don't know how to drive aircraft vehicles.");
28615                return 1;
28616            }
28617        }
28618    }
Reply
#6

Where is the function?
Reply
#7

Are you using some callback?
Reply
#8

Replace | with ||.
Reply
#9

pawn Код:
if ( newstate == PLAYER_STATE_DRIVER )
            {
                if ( IsAnAirVehicle ( GetPlayerVehicleID ( playerid ) )
                {
                    if (PlayerInfo[playerid][jProfesion] == 1 || PlayerInfo[playerid][jProfesion] == 2 || PlayerInfo[playerid][jProfesion] == 3 || PlayerInfo[playerid][jProfesion] == 4)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You don't know how to drive aircraft vehicles.");
                        return 1;
                    }
                }
            }
It should be just fine now.
Reply
#10

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
    {
        new newcar = GetPlayerVehicleID(playerid);
        if(newstate == PLAYER_STATE_DRIVER && oldstate == PLAYER_STATE_ONFOOT)
        {
            if(gTeam[playerid] == EHUMANO)
            {
                if(Motor[newcar] == 0)
                {
                    SendClientMessage(playerid, AMARILLO, " Press ALT or write /engine to toggle the engine.");
                }
                else
                {
                    SendClientMessage(playerid, AMARILLO, " Press ALT or write /engine to toggle the engine.");
                }

            }
            else if(gTeam[playerid] == EZOMBIE)
            {
                new Float:slx, Float:sly, Float:slz;
                GetPlayerPos(playerid, slx, sly, slz);
                SetPlayerPos(playerid, slx, sly, slz+2);
                SendClientMessage(playerid, ROJO_OSCURO, "* Zombies cant drive!");
            }
        }
        if(newstate == PLAYER_STATE_ONFOOT)
        {
            TextDrawHideForPlayer(playerid, Coche[playerid]);
        }
    }
    if ( newstate == PLAYER_STATE_DRIVER )
            {
                if ( IsAnAirVehicle ( GetPlayerVehicleID ( playerid ) )
                {
                            if (PlayerInfo[playerid][jProfesion] == 1 | PlayerInfo[playerid][jProfesion] == 2 | PlayerInfo[playerid][jProfesion] == 3 | PlayerInfo[playerid][jProfesion] == 4)
                    {
                        RemovePlayerFromVehicle(playerid);
                        SendClientMessage(playerid,COLOR_RED,"You don't know how to drive aircraft vehicles.");
                    }
                }
            }
pawn Код:
stock IsAnAirVehicle( vehicleid )
{
    new
        model = GetVehicleModel( vehicleid )
    ;
    switch ( model )
    {
        case 592: return 1;
        case 577: return 1;
        case 511: return 1;
        case 512: return 1;
        case 593: return 1;
        case 520: return 1;
        case 553: return 1;
        case 476: return 1;
        case 519: return 1;
        case 460: return 1;
        case 513: return 1;
        case 548: return 1;
        case 425: return 1;
        case 417: return 1;
        case 487: return 1;
        case 488: return 1;
        case 497: return 1;
        case 563: return 1;
        case 447: return 1;
        case 469: return 1;
    }
    return 0;
}
That's everything.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)