Car lock when owner is online -
chosen - 17.02.2010
Hello, I have a car ownership system inside my gamemode, and i tried to make the next thing.
Everytime a player connects, check if he has a car bought. If yes, lock the car automatically to all the players except him.
Everytime a player disconnects, check if he has a car bought. If yes, unlock the car automatically to all the players.
I used SetVehicleParamsForPlayer at the end of OnPlayerLogin callback (I'm using the register and login system from Godfather with some edits for my own gamemode) like this:
Код:
if(Info[playerid][eCarKeys] != 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(Info[playerid][eCarKeys], i, 0, 1)
}
}
}
And inside the OnPlayerDisconnect callback i used this:
Код:
if(Info[playerid][eCarKeys] != 0)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(Info[playerid][eCarKeys], i, 0, 0)
}
}
}
But, nothing happens. I mean, is not locking my car automatically after I login, and not unlocking my car after logout.
I tried with OnVehicleStreamIn too, but if I login and i'm not near the car, is not locking, and after disconnect if the car is locked, it remain locked.
I tried with Timers too, still nothing.
What else can I try or what i'm doing wrong, I don't have any more ideeas.
LE: Title changed ...
Re: Automatic car lock on login -
chosen - 18.02.2010
Bump!
Re: Automatic car lock when owner is online -
chosen - 19.02.2010
Bump?! (another 12 hours passed)
Really no-one?
Re: Automatic car lock when owner is online -
chosen - 21.02.2010
Bump!
Re: Car lock when owner is online -
chosen - 22.02.2010
Bump ...
Re: Car lock when owner is online -
Onyx09 - 22.02.2010
/lock command makes th eplaye rlock car if player uses it right
how about doing this
Код:
public onplayerconnect
you add this
for(new i; i < MAX_PLAYERS; i++)
{
if(i != playerid)
{
SetVehicleParamsForPlayer(Info[playerid][eCarKeys], i, 0, 0)
}
}
or what ever you will need to check the code but thats the idea for autolock on player connect