Invalid Function - 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: Invalid Function (
/showthread.php?tid=301021)
Invalid Function -
Oh - 02.12.2011
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.
Re: Invalid Function -
reckst4r - 02.12.2011
What error do you get?
Re: Invalid Function -
Oh - 02.12.2011
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;
Re: Invalid Function -
reckst4r - 02.12.2011
Could you post the script where you tell the line numbers?
Re: Invalid Function -
Oh - 02.12.2011
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 }
Re: Invalid Function -
reckst4r - 02.12.2011
Where is the function?
Re: Invalid Function -
WLSF - 02.12.2011
Are you using some callback?
Re: Invalid Function -
MP2 - 02.12.2011
Replace | with ||.
Re: Invalid Function -
sleepysnowflake - 02.12.2011
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.
Re: Invalid Function -
Oh - 02.12.2011
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.