class and vip allowed to use these vehicles... - 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: class and vip allowed to use these vehicles... (
/showthread.php?tid=487555)
class and vip allowed to use these vehicles... -
SwisherSweet - 13.01.2014
hey so i have this code but it does not work vip still get's locked out of vehicle....
Код:
public OnPlayerEnterVehicle(playerid, vehicleid)
{
new model = GetVehicleModel(vehicleid);
if(model == 425 && Player[playerid][class] != AIRFORCE || Player[playerid][viplevel] < 1 || model == 520 && Player[playerid][class] != AIRFORCE && Player[playerid][viplevel] < 1) {
ClearAnimations(playerid);
SendClientMessage(playerid, C_RED, "• You need the class Airforce to fly this vehicle(or V.I.P)!");
return 1;
}
if(model == 432 && Player[playerid][class] != HEAVY_GUNNER || Player[playerid][viplevel] < 1) {
ClearAnimations(playerid);
SendClientMessage(playerid, C_RED, "• You need the class Heavy Gunner drive this vehicle!(or V.I.P)");
return 1;
}
if(model == 416 && Player[playerid][class] != MEDIC || Player[playerid][viplevel] < 1) {
ClearAnimations(playerid);
SendClientMessage(playerid, C_RED, "• You need the class Medic drive this vehicle!(or V.I.P)");
return 1;
}
return 1;
}
thanks...
Re: class and vip allowed to use these vehicles... -
Voxel - 14.01.2014
You are using a incorrect control structure which is "<" and means "smaller then". In this case you are checking if the player has a vip level less then 1 and then execute the code, what you want to do is check if hes higher or equal to one.
pawn Код:
Player[playerid][viplevel] >= 1)
Take a look here:
https://sampwiki.blast.hk/wiki/Control_Structures
Good luck!
edit: I think I made a mistake, you are checking if hes less then one, you can simply change "<" to "== 0" but the above code will work aswell if you change your code a bit.
Re: class and vip allowed to use these vehicles... -
xZdadyZx - 14.01.2014
Quote:
Originally Posted by Voxel
You are using a incorrect control structure which is "<" and means "smaller then". In this case you are checking if the player has a vip level less then 1 and then execute the code, what you want to do is check if hes higher or equal to one.
pawn Код:
Player[playerid][viplevel] >= 1)
Take a look here: https://sampwiki.blast.hk/wiki/Control_Structures
Good luck!
edit: I think I made a mistake, you are checking if hes less then one, you can simply change "<" to "== 0" but the above code will work aswell if you change your code a bit.
|
Yeah true, but I got question for my future scripting... Do I even need to say that you do not need a vip, I think do you need to check every time on play enter car is he vip, or I dont need to.
Re: class and vip allowed to use these vehicles... -
Voxel - 14.01.2014
Quote:
Originally Posted by xZdadyZx
Yeah true, but I got question for my future scripting... Do I even need to say that you do not need a vip, I think do you need to check every time on play enter car is he vip, or I dont need to.
|
If you do not have a feature or something like that for vips then you obviously dont have to check for it. Like if you would have a feature that vips get a tuned car everytime they enter a vehicle then you would have to check if they are vips or not.
Hope that helped you.