SA-MP Forums Archive
Automatic unlocking? - 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: Automatic unlocking? (/showthread.php?tid=84542)



Automatic unlocking? - killdahobo99 - 01.07.2009

I tryed searching, but cannot find the right topics....

How do i make it so, if cars are /locked as the player gets out of the car it is automatically unlocked by itself.?

Thanks guys


Re: Automatic unlocking? - saiberfun - 01.07.2009

pawn Код:
OnPlayerExitVehicle(playerid,vehicleid)
{
SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
return 1;
}

Quote:
Originally Posted by Sa:Mp Wiki
SetVehicleParamsForPlayer


Sets certain properties of a car for a player.


Important note: Disabling the objective works only if the car is respawned after


Parameters:
(vehicleid,playerid,objective,doorslocked)
vehicle ID of the vehicle
playerid ID of the player
objective Show a marker above the car for this player?
doorslocked 0 means open,1 means locked


This function does not return a specific value, it's best to simply ignore it.
http://wiki.sa-mp.com
very usefull just browse abit through it and learn sum stuff^-^
then u wont need to ask so much on here


Re: Automatic unlocking? - killdahobo99 - 02.07.2009

Quote:
Originally Posted by saiberfun
pawn Код:
OnPlayerExitVehicle(playerid,vehicleid)
{
SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
return 1;
}

Quote:
Originally Posted by Sa:Mp Wiki
SetVehicleParamsForPlayer


Sets certain properties of a car for a player.


Important note: Disabling the objective works only if the car is respawned after


Parameters:
(vehicleid,playerid,objective,doorslocked)
vehicle ID of the vehicle
playerid ID of the player
objective Show a marker above the car for this player?
doorslocked 0 means open,1 means locked


This function does not return a specific value, it's best to simply ignore it.
http://wiki.sa-mp.com
very usefull just browse abit through it and learn sum stuff^-^
then u wont need to ask so much on here
That does not work, i get an error....

This is what i have under OnPlayerExitVehicle

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	InCar[playerid] = 0;
	return 1;
}
{
SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
return 1;
}



Re: Automatic unlocking? - saiberfun - 02.07.2009

pawn Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
     SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
    InCar[playerid] = 0;
    return 1;
}
why not just add it like that?^^
this should work now



Re: Automatic unlocking? - refshal - 02.07.2009

Quote:
Originally Posted by killdahobo99
That does not work, i get an error
Show us the error.


Re: Automatic unlocking? - saiberfun - 02.07.2009

Quote:
Originally Posted by cοοp
Quote:
Originally Posted by killdahobo99
That does not work, i get an error
Show us the error.
he did in Code

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	InCar[playerid] = 0;
	return 1;
}
{
SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
return 1;
}
it was because he just added anoth {
}
like that instead of just adding the playervehicleparams


Re: Automatic unlocking? - refshal - 02.07.2009

Quote:
Originally Posted by saiberfun
he did in Code
No he didn't. That was what he got. It could be easier to help him if he showed us the error.


Re: Automatic unlocking? - abhinavdabral - 02.07.2009

saiberfun ........... your code is cool for me ....WORKING


Re: Automatic unlocking? - kaisersouse - 02.07.2009

One thing you need to know about OnPlayerEnter and OnPlayerExit is that it is called when the player initiates the sequence of entering or exiting a vehicle...a sequence that can be CANCELED by the user. OnPlayerStateChange is called once the players state has actually changed, and that state change occurs after OnPlayerEnter/Exit has been called.


Re: Automatic unlocking? - killdahobo99 - 02.07.2009

Quote:
Originally Posted by saiberfun
Quote:
Originally Posted by cοοp
Quote:
Originally Posted by killdahobo99
That does not work, i get an error
Show us the error.
he did in Code

Код:
public OnPlayerExitVehicle(playerid, vehicleid)
{
	InCar[playerid] = 0;
	return 1;
}
{
SetVehicleParamsForPlayer(vehicleid,playerid,0,0);
return 1;
}
it was because he just added anoth {
}
like that instead of just adding the playervehicleparams
That complies, but...Say someone types /lock, this code you've given me is suppose to unlock the car right? if they get out ?

so how do i make it so it says "Vehicle unlocked" as soon as player gets out? Thanks Guys