[Solved]Thnx To Mansonh!
#2

Just checking, you want players to be able to use only these two, or you don't want them to be able to?

Try putting in a few printf statements to check if your admin is set correctly.

Код:
//==============================================================================
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
  printf("player(%d), level set to %d", playerid, PlayerInfo[playerid][Level]);
  if(PlayerInfo[playerid][Level] < 1)
	{
        print("Player is not an admin");
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(modelid != 476 && modelid != 520)
		{
			RemovePlayerFromVehicle(playerid);
			SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
		}
	}
	return 1;
}
Although I am not sure why you are doing it on keystate, seems a waste to have this check every time they press a key when you can just do it under onplayerstatechange.


Here is the code that will kick non admins out of hydras or rustlers.

Код:
//==============================================================================
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	printf("player(%d), level set to %d", playerid, PlayerInfo[playerid][Level]);
	if(newstate==PLAYER_STATE_DRIVER && PlayerInfo[playerid][Level] < 1)
	{
        print("Player is not an admin");
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(newkeys == 2 || newkeys == 3)
		{
			if(modelid == 476 || modelid == 520)
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
			}
		}
	}
	return 1;
}
Reply


Messages In This Thread
[Solved]Thnx To Mansonh! - by hvampire - 08.02.2010, 02:43
Re: help? - by mansonh - 08.02.2010, 04:18
Re: help? - by hvampire - 08.02.2010, 20:00

Forum Jump:


Users browsing this thread: 1 Guest(s)