SA-MP Forums Archive
RemovePlayer From Lock Cars - 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: RemovePlayer From Lock Cars (/showthread.php?tid=134145)



RemovePlayer From Lock Cars - MrLeNy - 15.03.2010

Hello. I have a problem, because when my car is closed and I wanted to do when a player is getting into the car to give him RemovePlayerFromVehicle (playerid).

This is the code:
Код:
if(newstate == 5 || newstate == 6)
{
if(CarInfo[vehid][cLock])RemovePlayerFromVehicle(playerid);
}
Please Help


Re: RemovePlayer From Lock Cars - ACERS - 15.03.2010

Quote:
Originally Posted by MrLeNy
This is the code:
Код:
if(newstate == 5 || newstate == 6)
{
if(CarInfo[vehid][cLock])RemovePlayerFromVehicle(playerid);
}
Please Help
Well do you have a /lock so it changes CarInfo[vehid][cLock] to something like 1 or another number so you can use it to define it's locked?

An Example Would Be Then:

Код:
if(newstate == 5 || newstate == 6)
{
  if(CarInfo[vehid][cLock] == 1)
  {
     RemovePlayerFromVehicle(playerid);
     return 1;
  }
}



Re: RemovePlayer From Lock Cars - Robert007 - 15.03.2010

Add CarInfo[vehid][cLock] = 0;

Код:
if(newstate == 5 || newstate == 6)
{
  if(CarInfo[vehid][cLock] == 1)
  {
     RemovePlayerFromVehicle(playerid);
     CarInfo[vehid][cLock] = 0;
     return 1;
  }
}



Re: RemovePlayer From Lock Cars - MaykoX - 16.03.2010

Quote:
Originally Posted by Robert007
Add CarInfo[vehid][cLock] = 0;

Код:
if(newstate == 5 || newstate == 6)
{
  if(CarInfo[vehid][cLock] == 1)
  {
     RemovePlayerFromVehicle(playerid);
     CarInfo[vehid][cLock] = 0;
     return 1;
  }
}
This is fail, CarInfo[vehid][cLock] = 0; will unlock the car lawl


Re: RemovePlayer From Lock Cars - Jay_ - 16.03.2010

Quote:
Originally Posted by MrLeNy
Hello. I have a problem, because when my car is closed and I wanted to do when a player is getting into the car to give him RemovePlayerFromVehicle (playerid).

This is the code:
Код:
if(newstate == 5 || newstate == 6)
{
if(CarInfo[vehid][cLock])RemovePlayerFromVehicle(playerid);
}
Please Help
That code is fine. Make sure you're setting the appropriate value to the variable when you lock the vehicle. In this case anything above 0.


Re: RemovePlayer From Lock Cars - Steven82 - 17.03.2010

Could this be scripted to where if you are not a cop or medic skin or anything etc, you get kicked from car?