Skin restricted 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: Skin restricted vehicles (
/showthread.php?tid=287979)
Skin restricted vehicles -
needhack - 05.10.2011
Hello there,
I would like to know how to put a skin restriction on vehicles.
For examle: Police skin 1 2 and 3 can enter an LVPD cruiser.
Other skins get removed from the vehicle and get a client message saying: You are not on police duty.
Help would be appreciated
Re: Skin restricted vehicles -
grand.Theft.Otto - 05.10.2011
Like so:
pawn Код:
// top of script
new PDCar1; // first police department car
// under ongamemodeinit
PDCar1 = AddStaticVehicle(modelid, Float:spawn_x, Float:spawn_y, Float:spawn_z, Float:angle, color1, color2);
// under onplayerstatechange
new vehicleid = GetPlayerVehicleID(playerid);
new skin = GetPlayerSkin(playerid);
if(skin != 165 || skin != 281 || skin != 282) // if the skin is not equal to these skin id's (few police officer skins)
{
if(newstate == PLAYER_STATE_DRIVER && vehicleid == PDCar1)
{
RemovePlayerFromVehicle(playerid); // Ejects the player from the vehicle.
SendClientMessage(playerid, -1, "This Vehicle Is For Use By Law Enforcement Only. You Cannot Use This Vehicle.");
GameTextForPlayer(playerid,"~w~ejected from the vehicle",5000,3);
return 1;
}
}
If you want more police cars to be unavailable to civilians, you need to add more separate vehicles using the variables I showed above (PDCar1, PDCar2, etc..)
https://sampwiki.blast.hk/wiki/Skins:Public
https://sampwiki.blast.hk/wiki/AddStaticVehicle
Re: Skin restricted vehicles -
needhack - 05.10.2011
Thank you very much!
Re: Skin restricted vehicles -
needhack - 14.10.2011
Hey, just put this in my script and it does NOT work.
I have the correct skin but it still ejects me.
Help would be appreciated.
Re: Skin restricted vehicles -
needhack - 16.10.2011
Hello there. I am still stuck at this and can't continue my script.
With this bump I hope to get helped.