SA-MP Forums Archive
Vehicles for Admins only! [help] - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Vehicles for Admins only! [help] (/showthread.php?tid=119960)



Vehicles for Admins only! [help] - Ridrik - 10.01.2010

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


Re: Vehicles for Admins only! [help] - TheChaoz - 10.01.2010

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


Re: Vehicles for Admins only! [help] - Ridrik - 10.01.2010

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


Re: Vehicles for Admins only! [help] - Babul - 10.01.2010

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;
		}
	}
}



Re: Vehicles for Admins only! [help] - Ridrik - 10.01.2010

Babul, Thank you so much, It worked!!


Re: Vehicles for Admins only! [help] - [eF]ThundeR - 10.01.2010

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


Re: Vehicles for Admins only! [help] - Ridrik - 10.01.2010

GetPlayerName(playerid)

I think this is what you are looking for.


Re: Vehicles for Admins only! [help] - Jeffry - 10.01.2010

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!!


Re: Vehicles for Admins only! [help] - Think - 10.01.2010

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