[HELP] SetvehicleParams
#1

when i /v lock i added setvehicleparamsforplayer... works but when i disconnect the car becomes "enter-able"

Any of you know of a fix that they continue to stay locked regardless?
Reply
#2

Make sure that you are reapplying it on OnVehicleStreamIn

Quote:
Note: From 0.3 you will have to re-apply this function when OnVehicleStreamIn is called!
Reply
#3

/\ was faster

check the wiki page about SetVehicleParamsForPlayer and you will know whats happening
Reply
#4

Thanks

Код:
// Will show vehicle markers for players streaming in for 0.3
new iVehicleObjective[MAX_VEHICLES][2];
 
public OnGameModeInit() //Or another callback
{
new temp = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 0,0, -1); //ID 1
iVehicleObjective[temp][0] = 1; //Marker
iVehicleObjective[temp][1] = 0; //Door Lock
return 1;
}
 
stock SetVehicleParamsForPlayerEx(vehicleid, playerid, objective, doorslocked)
{
	SetVehicleParamsForPlayer(vehicleid, playerid, objective, doorslocked);
	iVehicleObjective[vehicleid][0] = objective;
	iVehicleObjective[vehicleid][1] = doorslocked;
}
 
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	SetVehicleParamsForPlayer(vehicleid, forplayerid, iVehicleObjective[vehicleid][0], iVehicleObjective[vehicleid][1]);
}
Just a question why stock SetVehicleParamsForPlayerEx but then onvehstreamin SetVehicleParamsForPlayer.
It will error
Reply
#5

Reposted

Код:
iVehicleObjective[temp][1] = 0; //Door Lock
Wherewould i use this?
Reply
#6

SetVehicleParamsForPlayerEx is used to set the params and the variables,

And in OnVehicleSteamIn we only need to set the params so we only use SetVehicleParamsForPlayer

pawn Код:
iVehicleObjective[temp][1] = 0; //Door Lock
You never need to use that, just use SetVehicleParamsForPlayerEx
Reply
#7

This still doesnt work same issue...
Reply
#8

Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(PlayerInfo[i][pPcarkey] == vehicleid && forplayerid != i)
  		{
			if(CarInfo[i][cLock] == 1)
			{
                SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
		    }
			else if(CarInfo[i][cLock] == 0)
			{
                SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0);
			}
		}
		if(PlayerInfo[i][pPcarkey2] == vehicleid && forplayerid != i)
  	    {
			if(CarInfo[i][cLock] == 1)
			{
                SetVehicleParamsForPlayer(vehicleid,forplayerid,0,1);
		    }
			else if(CarInfo[i][cLock] == 0)
			{
                SetVehicleParamsForPlayer(vehicleid,forplayerid,0,0);
			}
		}
	}
	return 1;
}
I tried this still no luck
Reply
#9

With this CODE i log off the server and log in under a different acc and am able to get in the car but not start the engine.

When i log in with my account that owns the car, its still locked

Код:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
	for(new i = 0; i < MAX_PLAYERS; i++)
	{
		if(PlayerInfo[i][pPcarkey] == vehicleid && CarInfo[vehicleid][cLock] == 1)
		{
	 		for(new u = 0; u < MAX_PLAYERS; u++)
	   		{
	     		SetVehicleParamsForPlayer(vehicleid, u, 0, 1);
		    }
	   	}
		if(PlayerInfo[i][pPcarkey2] == vehicleid && CarInfo[vehicleid][cLock] == 1)
		{
			for(new u = 0; u < MAX_PLAYERS; u++)
			{
				SetVehicleParamsForPlayer(vehicleid, u, 0, 1);
	 		}
		}
	}
	return 1;
}
Reply
#10

bump
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)