SA-MP Forums Archive
Kick player out of vehicle if not a cop. - 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)
+--- Thread: Kick player out of vehicle if not a cop. (/showthread.php?tid=553895)



Kick player out of vehicle if not a cop. - DownDuckling - 01.01.2015

Hey, I haven't scripted in a LONG time and I am trying to find out why the hell this isn't working :P Can someone help

Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
	if(newstate == 2 && GetPlayerTeam(playerid, != 5);
	{
		if(GetVehicleModel(vehicleid) == 523, 427, 490, 528, 596, 598, 597, 599);
		RemovePlayerFromVehicle(playerid);
		SendClientMessage(playerid, COLOR_BLUE, "You are not an LEO!");
		return 1;
	}
}



Re: Kick player out of vehicle if not a cop. - Boot - 01.01.2015

Try:

pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerTeam(playerid, != 5);
    {
    new pVehicle = GetVehicleModel(vehicleid);
    if(pVehicle == 523 || pVehicle == 427 || pVehicle == 490 || pVehicle == 528 || pVehicle == 596 || pVehicle == 598 || pVehicle == 597 || pVehicle == 599)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_BLUE, "You are not an LEO!");
    }
    return 1;  
    }
}



Re: Kick player out of vehicle if not a cop. - Ryz - 01.01.2015

EDIT:Oops always late ;/


Re: Kick player out of vehicle if not a cop. - DavidBilla - 01.01.2015

There was a tiny mistake in Boot's code
I edited it,this should work.
pawn Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
    if(newstate == PLAYER_STATE_DRIVER && GetPlayerTeam(playerid) != 5)
    {
    new pVehicle = GetVehicleModel(vehicleid);
    if(pVehicle == 523 || pVehicle == 427 || pVehicle == 490 || pVehicle == 528 || pVehicle == 596 || pVehicle == 598 || pVehicle == 597 || pVehicle == 599)
    {
    RemovePlayerFromVehicle(playerid);
    SendClientMessage(playerid, COLOR_BLUE, "You are not an LEO!");
    }
    return 1;  
    }
}



Re: Kick player out of vehicle if not a cop. - DownDuckling - 01.01.2015

Thanks!