SA-MP Forums Archive
How to lock car? - 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: How to lock car? (/showthread.php?tid=268069)



How to lock car? - AgentZero - 11.07.2011

Hi everyone i'm having trouble with this, using the new 0.3c features I was wondering if anyone can help me lock a car for when a player is not in mission so if(InMission[playerid]==0) and they try to get on a car missioncar = AddStaticVehicle(415,1685.48720000,1751.96670000,1 0.59900000,268.11830000,25,1,2500); they wont be able to because the car will be locked thanks all :P


Re: How to lock car? - [MG]Dimi - 11.07.2011

Use
PHP код:
SetVehicleParamsForPlayer(vehicleid,playerid,objective,doorslocked
. Objective put 0 and doorslocked put 1.


Re: How to lock car? - dowster - 11.07.2011

try this out, should be ready to go
Код:
public OnPlayerConnect(playerid)
{
        SetVehicleParamsForPlayer( missioncar, playerid, 0, 1);
	return 1;
}
this way it will be locked for everyone, but in the beginning of the mission put:
Код:
SetVehicleParamsForPlayer(missioncar, playerid, 0, 0)
so to unlock it, and at the end of the mission just relock it again for that player


Re: How to lock car? - AgentZero - 11.07.2011

Quote:
Originally Posted by dowster
Посмотреть сообщение
try this out, should be ready to go
Код:
public OnPlayerConnect(playerid)
{
        SetVehicleParamsForPlayer( missioncar, playerid, 0, 1);
	return 1;
}
this way it will be locked for everyone, but in the beginning of the mission put:
Код:
SetVehicleParamsForPlayer(missioncar, playerid, 0, 0)
so to unlock it, and at the end of the mission just relock it again for that player
it didnt work any ideas?


Re: How to lock car? - dowster - 11.07.2011

hmm.. what didn't work, the locking or unlocking?


Re: How to lock car? - AgentZero - 11.07.2011

Quote:
Originally Posted by dowster
Посмотреть сообщение
hmm.. what didn't work, the locking or unlocking?
both the car didnt lock to begin with |:


Re: How to lock car? - dowster - 11.07.2011

hmm.. when is the car created? in OnGameModeInit?


Re: How to lock car? - AgentZero - 11.07.2011

Quote:
Originally Posted by dowster
Посмотреть сообщение
hmm.. when is the car created? in OnGameModeInit?
YES
4CHAR


Re: How to lock car? - dowster - 11.07.2011

try moving the locking code to the OnPlayerSpawn?


Re: How to lock car? - AgentZero - 11.07.2011

Quote:
Originally Posted by dowster
Посмотреть сообщение
try moving the locking code to the OnPlayerSpawn?
moved nothing happened here ill show you what i have

Код:
new missioncar;
missioncar = AddStaticVehicle(474,-1996.68286133,1224.90783691,31.54843712,270.00000000,-1,-1);

Onplayerconnect
 
SetVehicleParamsForPlayer(missioncar,playerid,0,1);