Locking System
#1

Can anyone give me a detailed walk threw on how vehicles are locked?

currently my cars are locked like:
Код:
LockLSPDCars(playerid)
	{
	  SetVehicleParamsForPlayer(1, playerid, 0, 1);
	  SetVehicleParamsForPlayer(2, playerid, 0, 1);
	  SetVehicleParamsForPlayer(3, playerid, 0, 1);
	  SetVehicleParamsForPlayer(4, playerid, 0, 1);
	  SetVehicleParamsForPlayer(5, playerid, 0, 1);
	  SetVehicleParamsForPlayer(6, playerid, 0, 1);
	  SetVehicleParamsForPlayer(7, playerid, 0, 1);
	  SetVehicleParamsForPlayer(8, playerid, 0, 1);
	  SetVehicleParamsForPlayer(9, playerid, 0, 1);
	  SetVehicleParamsForPlayer(10, playerid, 0, 1);
	  SetVehicleParamsForPlayer(11, playerid, 0, 1);
	  SetVehicleParamsForPlayer(12, playerid, 0, 1);
	  SetVehicleParamsForPlayer(13, playerid, 0, 1);
		SetVehicleParamsForPlayer(14, playerid, 0, 1);
		SetVehicleParamsForPlayer(15, playerid, 0, 1);
	 	SetVehicleParamsForPlayer(16, playerid, 0, 1);
	  SetVehicleParamsForPlayer(17, playerid, 0, 1);
	  SetVehicleParamsForPlayer(18, playerid, 0, 1);
	  SetVehicleParamsForPlayer(19, playerid, 0, 1);
	  SetVehicleParamsForPlayer(20, playerid, 0, 1);
	  SetVehicleParamsForPlayer(21, playerid, 0, 1);
		SetVehicleParamsForPlayer(22, playerid, 0, 1);
		SetVehicleParamsForPlayer(23, playerid, 0, 1);
		SetVehicleParamsForPlayer(24, playerid, 0, 1);
		SetVehicleParamsForPlayer(25, playerid, 0, 1);
		SetVehicleParamsForPlayer(26, playerid, 0, 1);
		SetVehicleParamsForPlayer(27, playerid, 0, 1);
		SetVehicleParamsForPlayer(28, playerid, 0, 1);
	}
How would I change that into the new system?
Reply
#2

https://sampwiki.blast.hk/wiki/OnVehicleStreamIn
Reply
#3

That did not help haha, thanks tho....
Reply
#4

Well you use OnVehicleStreamIn because when a vehicle is streamed out it removes the lock and the components, so under OnVehicleStreamIn you have to re-lock your vehicles.

Simple system,
pawn Код:
OnVehicleStreamIn(vehicle,forplayerid)
{
  if(PVeheicleLocked[forplayerid][vehicle])SetVehicleParamsForPlayer(...);//Lock
}
Reply
#5

if I have over 200 vehicles that are locked to the public and unlocked only for certain people, like above is LSPD. How would I add that to the new system?

If someone could give me an example with my above that would be greatly appreciated
Reply
#6

Read the stickied threads, http://forum.sa-mp.com/index.php?topic=119943.0
Reply
#7

Quote:
Originally Posted by dugi
I have dugi , numerous times trying to understand it lol. I'm sure its the most simple thing to do, I'm just not understanding it.....
Reply
#8

OnVehicleStreamIn > When Vehicle Load

So you can Lock Vehicle On Load or do other things
Reply
#9

Quote:
Originally Posted by BlackFoX
OnVehicleStreamIn > When Vehicle Load

So you can Lock Vehicle On Load or do other things
Yeah I understand that part :P My issue is, I have certain vehicles for certain players. So say vehicle id 12 is for LSPD, how do I set vehicle 12 to be unlocked for LSPD?
Reply
#10

Quote:
Originally Posted by Jason_Larson
Quote:
Originally Posted by BlackFoX
OnVehicleStreamIn > When Vehicle Load

So you can Lock Vehicle On Load or do other things
Yeah I understand that part :P My issue is, I have certain vehicles for certain players. So say vehicle id 12 is for LSPD, how do I set vehicle 12 to be unlocked for LSPD?
pawn Код:
OnVehicleStreamIn(vehicle,forplayerid)
{
  if(LSPD[forplayerid] != 1) // or whatever variable u use to check the LSPD people.
  {
  SetVehicleParamsForPlayer(...);//Lock
  }
}
Edit: yay 500th post and gangsta rank
Reply
#11

Quote:
Originally Posted by SaiBerFun
Quote:
Originally Posted by Jason_Larson
Quote:
Originally Posted by BlackFoX
OnVehicleStreamIn > When Vehicle Load

So you can Lock Vehicle On Load or do other things
Yeah I understand that part :P My issue is, I have certain vehicles for certain players. So say vehicle id 12 is for LSPD, how do I set vehicle 12 to be unlocked for LSPD?
pawn Код:
OnVehicleStreamIn(vehicle,forplayerid)
{
  if(LSPD[forplayerid] != 1) // or whatever variable u use to check the LSPD people.
  {
  SetVehicleParamsForPlayer(...);//Lock
  }
}
Edit: yay 500th post and gangsta rank
Awesome thanks! So if I have more than one LSPD Vehicle, how would I do that? 1 & 2 & 3?
Reply
#12

Quote:
Originally Posted by Jason_Larson
Awesome thanks! So if I have more than one LSPD Vehicle, how would I do that? 1 & 2 & 3?
easy
just unlock em all on it
if u dont want to do like
LSPD1
LSPD2 blah in the vehicleparams just make sure like
pawn Код:
OnVehicleStreamIn(vehicle,forplayerid)
{
    for (new v = LSPD1; i < LSPDLast; i++) //loops through the LSPD IDS
    {
      if(LSPD[forplayerid] != 1) // or whatever variable u use to check the LSPD people.
      {
      SetVehicleParamsForPlayer(...);//Lock
      }
    }
}
//make sure that LSPD1 = the first LSPDCar u spawned and LSPDLast is the Last
//and they all need to be spawned in a row
//if there are other cars between them delete them or move them cuz they be effected too
//v = the vehicleid u need to use then
i dunno if this works didnt test it
but i guess it should
there are other ways to only check it for the car that gets streamed in but
this way is easier n i like it better
Reply
#13

Ok, I'll give it a shot. Thank you very very much for the help. I don't see why the DEV team just didn't leave this alone, just causes more work for Scripters lol or me more headakes.

Also how do they lock now?

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)