AVS Problem
#1

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

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

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

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

Thanks man I will look into it

Have a great day
Reply
#6

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


Forum Jump:


Users browsing this thread: 1 Guest(s)