SA-MP Forums Archive
why this doesnt work : - 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: why this doesnt work : (/showthread.php?tid=125781)



why this doesnt work : - hvampire - 05.02.2010

Код:
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 .


Re: why this doesnt work : - VonLeeuwen - 05.02.2010

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


Re: why this doesnt work : - MadeMan - 05.02.2010

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



Re: why this doesnt work : - hvampire - 05.02.2010

undefined symbol newstate


Re: why this doesnt work : - hvampire - 05.02.2010

nvm it worked dude , tyvm!


Re: why this doesnt work : - hvampire - 05.02.2010

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] == ?) {


Re: why this doesnt work : - MadeMan - 05.02.2010

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



Re: why this doesnt work : - hvampire - 05.02.2010

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


Re: why this doesnt work : - MadeMan - 05.02.2010

Then you're not using PlayerInfo[playerid][Level]


Re: why this doesnt work : - hvampire - 05.02.2010

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