Problem Server Shut Down & DestroyPVehs
#1

Hello. I have a problem. When the server fail or restart the GamePanel, playerii not receive Status 0, ie offline and the panel, they appear to be online on the server, but actually they are not on the server. Can you help me? Thank you in advance.



Besides, I have a problem. I have a dynamic private vehicles, and when the player comes on the server does not cripples cars.


stock DestroyPVehs(playerid)
{
new x = 1;
for(new c=0;c<MAX_VEH_PERS;c++)
{
if(strmatch(CarInfo[c][cOwner], PlayerInfo[playerid][pNormalName]))
{
if(OwnedVeh(GetIdOwn(GetSlot(playerid,x-1))))
{
OwnedVeh© = 0;
DestroyVehicle©;
foreach(Player,i)
{
if(HireCar == c)
{
HireCar = -1;
SwitchKey = 2;
}
}
x++;
}
}
}
return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
DestroyPVehs(playerid);
return 1;
}


stock GetSlot(playerid,slotid)
{
new x = -1,vehid;
for(new c;c<MAX_VEH_PERS;c++)
{
if(strmatch( CarInfo[c][cOwner], PlayerInfo[playerid][pNormalName] ) )
{
x++;
vehid = c;
if(x == slotid)
return vehid;
}
}
return 0;
}

stock GetVehNumber(playerid)
{
new nr = 0;
for(new i = 1; i < MAX_VEH_PERS; i++)
{
if(strmatch(CarInfo[i][cOwner], PlayerInfo[playerid][pNormalName]))
nr ++;
}
return nr;
}

stock GetIdOwn(carid)
{
for(new v;v<MAX_VEH_PERS;v++)
{
if(carid == OwnedVeh(v))
return v;
}
return 0;
}
Reply
#2

Use a php tags to wrap your code, this is hard to read, also format your code.
I am here cause i want to help, but reading threads like this make me wanna go back to bed.

Also your problem doesn't seem to belong here, at least not the first one.

And what do you mean by cripple cars?
Reply
#3

PasteBin: http://pastebin.com/zF0T5Dvx
Reply
#4

Server crash means instant exit. No OnGameModeExit, no OnPlayerDisconnect. Nothing. This can't be solved either. You can only hope to prevent crashes from happening in the first place. A server should ideally always be closed with RCON exit, not by killing the process (which I assume is what the gamepanel does).
Reply
#5

http://imgur.com/a/tiejs not work
Reply
#6

Okey, but for DestroyPVehs? You can help me?
Reply
#7

Please help me.
Reply
#8

I solved. The bug is at "for(new c=0".correct version is "for(new c;", just c. Please T/C
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)