Not locking vehicle
#1

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);
  	}
Reply
#2

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
Reply
#3

How do you set a vehicle to stream in again?
Reply
#4

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.
Reply
#5

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?
Reply
#6

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

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
Reply
#8

You use SetVehicleParamsForPlayer under OnVehicleStreamIn
Reply
#9

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;
}

Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)