SA-MP Forums Archive
IsPlayerInVehicle - 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: IsPlayerInVehicle (/showthread.php?tid=425594)



IsPlayerInVehicle - Avi Raj - 26.03.2013

Hey,

Can Anyone Help me how can i add more than one vehicle id here :-
Код:
if(IsPlayerInVehicle(playerid, 519)) return SendClientMessage(playerid,-1,"You must be in a Plane to Do Work");
and how to fix this error :-
Код:
C:\DOCUME~1\User\Desktop\Server\GAMEMO~1\aviator.pwn(1278) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
My Line :-
Код:
{
else
}
Please.


Re: IsPlayerInVehicle - dusk - 26.03.2013

pawn Код:
if(IsPlayerInVehicle(playerid,(519 || 520))) return SendClientMessage(playerid,-1,"You must be in a Plane to Do Work");
think that should work
*


Re: IsPlayerInVehicle - RajatPawar - 26.03.2013

Quote:
Originally Posted by dusk
Посмотреть сообщение
pawn Код:
if(IsPlayerInVehicle(playerid,(519 || 520))) return SendClientMessage(playerid,-1,"You must be in a Plane to Do Work");
think that should work
*
That will not work.

You can use the OR operator !
pawn Код:
if( IsPlayerInVehicle(playerid, some_vehicle_id) || IsPlayerInVehicle(playerid, another_vehicle_id) || ...) return --;
About the 2nd part, why are you using else if there's no code there?


Re: IsPlayerInVehicle - Avi Raj - 26.03.2013

it have :-
Код:
{
else
}
if(IsPlayerInVehicle(playerid, 519) || IsPlayerInVehicle(playerid, 593)) return SendClientMessage(playerid,-1,"You must be in a Plane to Do Work");



Re: IsPlayerInVehicle - Gamer_007 - 26.03.2013

Quote:
Originally Posted by Thour57
Посмотреть сообщение
it have :-
Код:
{
else
}
if(IsPlayerInVehicle(playerid, 519) || IsPlayerInVehicle(playerid, 593)) return SendClientMessage(playerid,-1,"You must be in a Plane to Do Work");
Woh! this is something curious.You have to use else like this

pawn Код:
if(condition)
{
//codes
}
else
{
//codes
}
Ur format is wrong.