Vehicles for Admins only! [help]
#1

Hello,

I have been trying to get this working for 2 hours, but in the end desided to visit over here

I want a script that will check if a player is in a vehicle which id is 522, and if he is NOT a RCON admin, he will be ejected out of it using RemovePlayerFromVehicle(playerid);

Can anybody help me? I Would like the script to automatically check if the person is admin or not and if he is in vehicle ID 522.

Thank you

Note*- I am running a stunt/deathmatch/roleplay server, but I need helpers/admins, if you want to be an admin, pm me and we can make it happen
Reply
#2

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(vehicleid == 522 && !IsPlayerAdmin(playerid)){
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid,0xFF0000FF,"ERROR: This vehicle is for admins");}
return 1;
}
I hope it helps u
Reply
#3

Nope doesn't work ;( It doesn't eject the player.
Thanks for trying though ;(
Reply
#4

refine the code above...
Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
	if(newstate == PLAYER_STATE_DRIVER)
	{
	  new VehID;
	  VehID=GetVehicleModel(GetPlayerVehicleID(playerid));
		if(VehID == 522 && !IsPlayerAdmin(playerid))
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid,0xFF0000FF,"ERROR: This vehicle is for admins");
			return 1;
		}
	}
}
Reply
#5

Babul, Thank you so much, It worked!!
Reply
#6

to dont open new topic i will ask here...
how to make admin vehicle or vehicle reserved only for guy with the name NooB?
Reply
#7

GetPlayerName(playerid)

I think this is what you are looking for.
Reply
#8

Quote:
Originally Posted by Beg1nn3r
to dont open new topic i will ask here...
how to make admin vehicle or vehicle reserved only for guy with the name NooB?
Check this: http://forum.sa-mp.com/index.php?topic=116016.0
Best tutorial!!
Reply
#9

Quote:
Originally Posted by Ridrik
I want a script that will check if a player is in a vehicle which id is 522,
next time, say that you mean the model.

The chaoz has the right code for your exact question, just to let you know
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)