Police only...
#3

The problem is that you're comparing the model of the vehicle to the ID of the vehicle.

pawn Code:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == Cars[Police])
You could either change == Cars[Police] to be the model ID of the vehicle, or you could simply edit it to work with the way you have it set up

pawn Code:
if(GetPlayerVehicleID(playerid) == Cars[Police])
Also there's a problem, you only have one variable for the vehicles, so basically Cars[Police] only contains one of the vehicle ID's (the last one you set it to). The only solution to this is to make Cars[Police] an array, and store multiple vehicle ID's in the array, then use a loop to go through them. This is a bit too much for something that can be done a lot easier and more effectively, so I recommend the simple solution which is something like.

pawn Code:
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 596)
Add if you want to check more models, you'd need a loop or just a long list of checks on that line.

pawn Code:
new model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(model == 596 || model == 427 || model == 601 || model == 599)
Edit: Someone else also showed you how you can do it with a simple switch statement, either way will work however the switch statement would be cleaner.
Reply


Messages In This Thread
Police only... - by Luis- - 06.08.2010, 21:06
Re: Police only... - by KennethRandall - 06.08.2010, 21:14
Re: Police only... - by JaTochNietDan - 06.08.2010, 21:16
Re: Police only... - by Luis- - 06.08.2010, 21:35
Re: Police only... - by Kar - 06.08.2010, 21:47
Re: Police only... - by Jacks - 07.08.2010, 03:27

Forum Jump:


Users browsing this thread: 3 Guest(s)