SA-MP Forums Archive
Not locking vehicle - 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: Not locking vehicle (/showthread.php?tid=109662)



Not locking vehicle - Christopher. - 21.11.2009

I coded this to lock the vehicle, I put it in OnPlayerConnect but it don't work, the idea was that it locks the vehicle for all players, I wanted to lock the vehicle with nobody in, heres the code:

Code:
	new i;
 	while(i < MAX_PLAYERS)
 	{
  		if(i == playerid) continue;
   	SetVehicleParamsForPlayer(hotdog,i++,0,1);
  	}



Re: Not locking vehicle - niCe - 21.11.2009

First of all, if that code is in OnPlayerConnect, you don't need to loop players - just SetVehicleParamsForPlayer(vehicleid, playerid, ...

Since SA-MP 0.3, SetVehicleParamsForPlayer need to be reapplied when vehicle streams in - you can use callback for that - OnVehicleStreamIn.

https://sampwiki.blast.hk/wiki/SetVehicleParamsForPlayer


Re: Not locking vehicle - Christopher. - 21.11.2009

How do you set a vehicle to stream in again?


Re: Not locking vehicle - bigcomfycouch - 21.11.2009

Vehicles will stream in when you get in range of it. If you set the vehicle parameters while the vehicle is already streamed for a player, you have to stream it again. Alternatively, you can create a command to lock it which will lock it even if it's not streamed, although you'd still have to have the code in OnVehicleStreamIn so that it'd be locked when someone goes in range of the car.


Re: Not locking vehicle - jonybomb - 21.11.2009

I can't understand that very well, in my pen gm that bugs my hotwire mission and i am triyng fix that in the last week, i am confuse with the stream vehicles? What is that? How i stream vehicles?


Re: Not locking vehicle - dice7 - 21.11.2009

https://sampwiki.blast.hk/wiki/OnVehicleStreamIn


Re: Not locking vehicle - jonybomb - 21.11.2009

I already see that..............................

but i can't apply that in pen gm. i can't understand what i have to do to fix this, and moe don't respond me.

Why samp stuff do things like that? :S

Someone helps :S


Re: Not locking vehicle - dice7 - 21.11.2009

You use SetVehicleParamsForPlayer under OnVehicleStreamIn


Re: Not locking vehicle - jonybomb - 21.11.2009

And how I call the public function into another script?

Here

Quote:

if(MissionActive == 9)
{
SendClientMessage(playerid, COLOR_YELLOW, objstore);
RingTone[playerid] = 20;
SetVehicleParamsForPlayer(stealcar,playerid,1, 0);
SendClientMessage(playerid, COLOR_WHITE, "*HINT: GO STEAL THE CAR.");
GameTextForPlayer(playerid, "~r~Hotwire ~n~~y~Mission", 5000, 1);
return 1;
}




Re: Not locking vehicle - jonybomb - 22.11.2009

bump