SA-MP Forums Archive
[HELP] SetvehicleParams - 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: [HELP] SetvehicleParams (/showthread.php?tid=264281)



[HELP] SetvehicleParams - euRo - 25.06.2011

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?


Re: [HELP] SetvehicleParams - [HiC]TheKiller - 25.06.2011

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!



AW: [HELP] SetvehicleParams - Nero_3D - 25.06.2011

/\ was faster

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


Re: [HELP] SetvehicleParams - euRo - 25.06.2011

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


Re: [HELP] SetvehicleParams - euRo - 25.06.2011

Reposted

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


AW: [HELP] SetvehicleParams - Nero_3D - 25.06.2011

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


Re: [HELP] SetvehicleParams - euRo - 25.06.2011

This still doesnt work same issue...


Re: [HELP] SetvehicleParams - euRo - 25.06.2011

Код:
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


Re: [HELP] SetvehicleParams !!HELP PLEASE :< - euRo - 25.06.2011

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



Re: [HELP] SetvehicleParams - euRo - 25.06.2011

bump