Automatic unlocking?
#1

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

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

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

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

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

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

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

saiberfun ........... your code is cool for me ....WORKING
Reply
#9

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

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)