SA-MP Forums Archive
AVS Problem - 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)
+--- Thread: AVS Problem (/showthread.php?tid=320047)



AVS Problem - ChristofferHoffmann - 21.02.2012

I'm using the vehicle system AVS, and I'm having some trouble with the lock system. You can easily /lock and then you wont be able to enter, but if I forexample walk abit away, teleport away or relog then it's unlocked for everybody, I suppose it's something with the OnVehicleStreamIn. I don't know if I somehow have to make sure it tells if the car is locked or not, when the player can see it. So it stays locked until /lock again. I hope you guys can help me out, since I'm kinda confused with that filterscript

Here's the script: https://sampforum.blast.hk/showthread.php?tid=276887


Re: AVS Problem - Toreno - 21.02.2012

Under OnVehicleStreamIn public, you should do something like this;
pawn Код:
public OnVehicleStreamIn( vehicleid, forplayerid )
{
    if( !Variable[ vehicleid ][ enum ] ) // This is when car is unlocked, change it to your variable and lock enum.
        // Unlock the car for forplayerid.
    else if( Variable[ vehicleid ][ enum ] ) // This is when car is locked, change it to your variable and lock enum.
        // Lock the car for forplayerid.
       
    return 1;
}



Re : AVS Problem - ChristofferHoffmann - 21.02.2012

Sooo... if this is the /lock command, how would I use the stream thing? Sorry, I'm still in the learning process. If you can explain further I would be happy.


Код:
CMD:lock(playerid, params[])
{
	new vehicleid;
	if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
	{
		vehicleid = GetPlayerVehicleID(playerid);
	}
	else
	{
		vehicleid = GetClosestVehicle(playerid);
		if(!PlayerToVehicle(playerid, vehicleid, 5.0)) vehicleid = 0;
	}
	if(!vehicleid) return SendClientMessage(playerid, COLOR_RED, "You are not close to a vehicle!");
	new id = GetVehicleID(vehicleid);
	if(!IsValidVehicle(id)) return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
	if(GetPlayerVehicleAccess(playerid, id) < 2)
		return SendClientMessage(playerid, COLOR_RED, "You don't have the keys for this vehicle!");
	new engine, lights, alarm, doors, bonnet, boot, objective;
	GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	if(doors == 1)
	{
		doors = 0;
		GameTextForPlayer(playerid, "~g~doors unlocked", 3000, 6);
	}
	else
	{
		doors = 1;
		GameTextForPlayer(playerid, "~r~doors locked", 3000, 6);
	}
	SetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
	return 1;
}
I really appreciate your time.


Re: AVS Problem - Toreno - 21.02.2012

It's not working with an enum so that would be useless to try (un)locking the car on streaming public when you don't know whether it's locked or not, I suggest you would switch to a different vehicle system, because there are better than this one, such as;
https://sampforum.blast.hk/showthread.php?tid=235593
https://sampforum.blast.hk/showthread.php?tid=248707

I repeat, there are plenty of them, pick your favorite.


Re : AVS Problem - ChristofferHoffmann - 21.02.2012

Thanks man I will look into it

Have a great day


Re: Re : AVS Problem - Toreno - 21.02.2012

Quote:
Originally Posted by ChristofferHoffmann
Посмотреть сообщение
Thanks man I will look into it

Have a great day
You too, man. Also, start learning the pawn language, it's easy once you get into it.