faction vehicles 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)
+--- Thread: faction vehicles help (
/showthread.php?tid=548643)
faction vehicles help -
Blademaster680 - 01.12.2014
Hi
I am trying to make this function so when a player enters a cop car, and they are not part of the police faction it will remove them from the car and tell them they are not part of that faction. But only if they are in the driver seat.
Here is my code:
Код:
public OnPlayerStateChange(playerid, newstate, oldstate)
{
new vehicleid = GetPlayerVehicleID(playerid);
if(newstate == 2)
{
SetPlayerArmedWeapon(playerid, 0);
if(IsLAPDVeh(vehicleid) && pInfo[playerid][pFaction] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You are not in the LAPD");
}
else if(IsLAFMDVeh(vehicleid) && pInfo[playerid][pFaction] != 2)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_GREY, "You are not in the LAFMD");
}
}
return 1;
}
stock IsLAPDVeh(vehicleid)
{
for(new i = 0; i < sizeof(LAPDVeh); ++i)
{
if(vehicleid == LAPDVeh[i]) return 1;
}
return 0;
}
This is under ongamemodeinit:
Код:
LAPDVeh[0] = AddStaticVehicleEx(596, 1602.8655, -1684.0818, 5.5351, 89.8200, -1, -1, 3000);
Re: faction vehicles help -
Airblog - 01.12.2014
Код:
if(newstate == PLAYER_STATE_DRIVER && oldstate != PLAYER_STATE_DRIVER)
{
new vehicleid = GetPlayerVehicleID(playerid);
else if(IsLAPDVeh(vehicleid) && PlayerInfo[playerid][pFaction] != 1)
{
RemovePlayerFromVehicle(playerid);
SendClientMessage(playerid, COLOR_ORANGE, " You are not in LAPD faction.");
}
try it!
Re: faction vehicles help -
Blademaster680 - 01.12.2014
Nope still same problem. They can get in and drive off even if they not LAPD
Re: faction vehicles help -
Blademaster680 - 01.12.2014
Ok I got it working Thanks