if(..) doesn't work correctly. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: if(..) doesn't work correctly. (
/showthread.php?tid=248988)
if(..) doesn't work correctly. -
Ash. - 16.04.2011
RESOLVED. Fixed by using empty statement and else.
Good Evening all,
First off, sorry if my description of my problem seems a little vague, i have had no sleep for about 40 hours, and really really cannot be arsed with typing anymore.
Anyway, I seem to be having a problem with an if statement. I requested assistance on such problem before, and now cannot find the thread.
I am trying to see if a player is in the correct type of vehicle, by doing this:
pawn Код:
new m = 403 || 514 || 515;
if(GetVehicleModel(GetPlayerVehicleID(playerid)) != m) return Error(playerid, 0);
(Before anyone asks, Error(playerid, 0) would do:
pawn Код:
case 0:
{
SendClientMessage(playerid, COLOUR, "You are not in the correct vehicle for your job");
}
)
Can anyone see a problem?
Thanks,
Ash
Re: if(..) doesn't work correctly. -
Backwardsman97 - 16.04.2011
Why not just do this because the way you're doing it won't work.
pawn Код:
new v = GetPlayerVehicleID(playerid);
if(GetVehicleModel(v) != 403 && GetVehicleModel(v) != 514 && GetVehicleModel(v) != 515) return Error(playerid, 0);
Edit: Shit. Didn't see the resolved.