[QESTION] OnGameModeExit() and car locking -
Dirkon - 27.07.2011
Hello everybody,
So I was thinking... Is there some OnGameModeExit() alternatives? OnGameModeExit() is called just when you type in console: exit, but I need it to be call, lets say when my server crashes or when I turn off my server with "X", not with typing: exit. Any sollutions?
CAR LOCKING problem:
I've made a little command like this:
pawn Код:
if(!strcmp(cmdtext,"/lock",true))
{
new carid = GetPlayerVehicleID(playerid);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(carid,engine,lights,alarm,doors,bonnet,boot,objective);
for(new i = 0; i < MAX_VEHICLES; i++)
{
new Float:px, Float:py, Float:pz;
GetPlayerPos(playerid, px, py, pz);
if(VehicleToPoint(100, i, px, py, pz))
{
new IsOwner[MAX_PLAYER_NAME];
GetPlayerName(playerid, IsOwner, sizeof(IsOwner));
if(strmatch(CarInfo[i][owner], IsOwner))
{
if(doors == 0)
{
SetVehicleParamsEx(i,engine,lights,alarm,1,bonnet,boot,objective);
}
if(doors == 1)
{
SetVehicleParamsEx(i,engine,lights,alarm,0,bonnet,boot,objective);
}
}
}
}
return 1;
}
I think it should lock the car if it's unlocked, and unlock, if it's locked. But it doesn't. It just locks a car. Anyone knows why?
Re: [QESTION] OnGameModeExit() and car locking -
iPLEOMAX - 27.07.2011
Instant 'End Process' doesn't even give the server a chance to run more functions. ^^
( X Button or Right-Click > Close or Crash )
Example:
> 3 people (Alive) using Lift to go to the ground floor. (Before: 3 on top floor - After: 3 on ground floor)
> But In-between someone farts a poisonous gas (Instant Death), and 3 of em dies.
> No chance they'll survive till they reach down to continue something.
Makes sense? IDK.
Re: [QESTION] OnGameModeExit() and car locking -
Dirkon - 27.07.2011
Ok, I understood.

and what about cmd?
Re: [QESTION] OnGameModeExit() and car locking -
iPLEOMAX - 27.07.2011
You should use else if or switch.
> Door state: Locked.
> Your first 'if' statement: Unlock. [Doors gets unlocked]
> Second 'if' statement: Locked, because script sees it unlocked.
pawn Код:
switch(doors)
{
case 0: { SetVehicleParamsEx(i,engine,lights,alarm,1,bonnet,boot,objective); SendClientMessage(playerid, -1, "Un-Locked."); }
case 1: { SetVehicleParamsEx(i,engine,lights,alarm,0,bonnet,boot,objective); SendClientMessage(playerid, -1, "Locked."); }
}