How to make auto eject
#1

I want to make a vehicle non enterable unless you are an admin.

I have a vague idea of what it might look like but i don't know where to put the code.
I'd also like someone to tell me what the code would be.
Reply
#2

ban a model
pawn Код:
onplayerstatechange
new model;
model = GetVehicleModel(GetPlayerVehicleID(playerid));
if(model == Bannedmodel && !IsPlayerAdmin(playerid))RemovePlayerFromVehicle(playerid);
there ya go have a play with that change bannedmodel to the admin car
or ban a single car
pawn Код:
onplayerstatechange
new vid;
vid = GetPlayerVehicleID(playerid);
if(vid == Bannedvehicleid && !IsPlayerAdmin(playerid))RemovePlayerFromVehicle(playerid);
Reply
#3

Where exactly would i put the vehicle id in the single vehicle removal?
Reply
#4

where it says "bannedvehicleid"

This forum requires that you wait 120 seconds between posts. Please try again in 55 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 46 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 39 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 24 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 18 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 11 seconds.
This forum requires that you wait 120 seconds between posts. Please try again in 6 seconds.
Reply
#5

e.g Maverick would be

Код:
new vid;vid = GetPlayerVehicleID(playerid);if(vid == Bannedvehicleid == 487) && !IsPlayerAdmin(playerid))RemovePlayerFromVehicle(playerid);
?
Reply
#6

like
pawn Код:
new vid;
vid = GetPlayerVehicleID(playerid);
if(vid == 487) && !IsPlayerAdmin(playerid))RemovePlayerFromVehicle(playerid);
but i know the 487 is the modelid of a maverick not a vehicle id so unless there in the 487 vehicle you loaded this wont work
so do you want to ban people from all mavericks or just that one?
Reply
#7

From just one maverick

AddStaticVehicle(487,-221.8909,2658.0103,62.7782,181.4946,46,46);
Reply
#8

at the topof your script go
pawn Код:
new adminveh;
then change that line to
pawn Код:
adminveh = AddStaticVehicle(487,-221.8909,2658.0103,62.7782,181.4946,46,46);
then use
pawn Код:
new vid;
vid = GetPlayerVehicleID(playerid);
if(vid == adminveh && !IsPlayerAdmin(playerid))RemovePlayerFromVehicle(playerid);
Reply
#9

OK Got it working now, thanks!
Reply
#10

hmm what is that vid :/
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)