why this doesnt work :
#1

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(IsPlayerInAnyVehicle(vehicleid) != 476, 520)
	 {
 	 RemovePlayerFromVehicle(playerid);
	 SendClientMessage(playerid, 0xFF9900AA, "This Vehicle Is Not Allowed!");
return 1;
}
return 1;
}
can u tell me how to fix it , i want when a player get in a vehicle (exept rustlers and hydras) it removes him from the vehicle .
Reply
#2

Try this

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid;
    vehicleid = GetPlayerVehicleID(playerid);
    if(newstate == 2 || newstate == 3)
    {
      if(vehicleid == 476 || vehicleid == 520)
      {
        RemovePlayerFromVehicle(playerid);
        SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
        }
    }
    return 1;
}
UNTESTED
Reply
#3

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    new vehicleid = GetPlayerVehicleID(playerid);
    new modelid = GetVehicleModel(vehicleid);
    if(newstate == 2 || newstate == 3)
    {
        if(modelid != 476 && modelid != 520)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
        }
    }
    return 1;
}
Reply
#4

undefined symbol newstate
Reply
#5

nvm it worked dude , tyvm!
Reply
#6

but 1 more question , how i made this thing work for normal players only not admins , i mean if admin get in any vehicle it doesnt do anything , but if normal player kick him

note : i use : if(PlayerInfo[playerid][Level] == ?) {
Reply
#7

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(PlayerInfo[playerid][Level] < 1)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        new modelid = GetVehicleModel(vehicleid);
        if(newstate == 2 || newstate == 3)
        {
            if(modelid != 476 && modelid != 520)
            {
                RemovePlayerFromVehicle(playerid);
                SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
            }
        }
    }
    return 1;
}
Reply
#8

didnt work , i am admin level 5 and it still kick me from the car
Reply
#9

Then you're not using PlayerInfo[playerid][Level]
Reply
#10

that's the whole code :

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
  if(PlayerInfo[playerid][Level] < 1)
	{
		new vehicleid = GetPlayerVehicleID(playerid);
		new modelid = GetVehicleModel(vehicleid);
		if(newstate == 2 || newstate == 3)
		{
			if(modelid != 476 && modelid != 520)
			{
				RemovePlayerFromVehicle(playerid);
				SendClientMessage(playerid,0xFF9900AA, "This vehicle is not allowed!");
			}
		}
	}

	if(!gPlayerUsingLoopingAnim[playerid]) return;


		if(IsKeyJustDown(KEY_HANDBRAKE,newstate,oldstate)) {
	  StopLoopingAnim(playerid);
    TextDrawHideForPlayer(playerid,txtAnimHelper);
    animation[playerid] = 0;
  }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)