Skin restricted vehicles
#1

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
Reply
#2

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
Reply
#3

Thank you very much!
Reply
#4

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.
Reply
#5

Hello there. I am still stuck at this and can't continue my script.
With this bump I hope to get helped.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)