08.11.2013, 16:56
Hello guys, please can someone tell me what is causing this bug? I will explain the situation. I am using command SetVehicleParamsForPlayer to lock vehicles for players, what aren't working in Police faction. And for example when normal player comes near to this police car, and he press F/ENTER to enter vehicle, he will run to enter vehicle and it will do following: (When is player entering the doors, it will show so it is locked)
![](/imageshack/img547/9050/zkcx.png)
But, when player leaves the vehicle and when he tries to enter it again, it won't do it again, player just keep stand on same position and he won't run to enter car.
Second thing is, when player got set his job to 1 (1 means so he is able to ride, and he can enter the police cruiser), then problem arrives. When player press F/ENTER to enter vehicle it won't do something, he is still standing on same position, but when players press G to car and he enters it and then he leave car, then it'll work correctly. When player again press F/ENTER to enter vehicle, he'll just normally get in.
Posting my codes, what are doing this:
Really big thanks for responsing to me!
![](/imageshack/img547/9050/zkcx.png)
But, when player leaves the vehicle and when he tries to enter it again, it won't do it again, player just keep stand on same position and he won't run to enter car.
Second thing is, when player got set his job to 1 (1 means so he is able to ride, and he can enter the police cruiser), then problem arrives. When player press F/ENTER to enter vehicle it won't do something, he is still standing on same position, but when players press G to car and he enters it and then he leave car, then it'll work correctly. When player again press F/ENTER to enter vehicle, he'll just normally get in.
Posting my codes, what are doing this:
pawn Код:
new PoliceCruiser[MAX_VEHICLES];
public OnGameModeInit ()
{
SetGameModeText ("Las Venturas Roleplay");
PoliceCruiser [1] = AddStaticVehicle (598, 2251.6812, 2443.6890, 10.5676, 0, 0, 1);
PoliceCruiser [2] = AddStaticVehicle (598, 2256.0208, 2443.6890, 10.5676, 0, 0, 1);
PoliceCruiser [3] = AddStaticVehicle (598, 2260.3676, 2443.6890, 10.5676, 0, 0, 1);
return true;
}
public OnPlayerEnterVehicle (playerid, vehicleid, ispassenger)
{
for (new i = 0; i < 12; i++)
{
if (vehicleid == PoliceCruiser [i])
{
if (PlayerInfo [playerid] [pFaction] == 1)
{
SetVehicleParamsForPlayer (PoliceCruiser [i], playerid, 0, 0);
}
else
if (PlayerInfo [playerid] [pFaction] != 1)
{
SetVehicleParamsForPlayer (PoliceCruiser [i], playerid, 0, 1);
}
}
}
return true;
}
![Sad](images/smilies/sad.gif)