I'm currently scripting an Cops'n'Robbers server and learning pretty fast.
But i've found that on 2 moments, the data gets "corrupt" or not saved correctly if you crash.
Код:
public OnPlayerDisconnect(playerid, reason)
{
// IRC
/*new leaveMsg[128], name[MAX_PLAYER_NAME], reasonMsg[8];
switch(reason)
{
case 0: reasonMsg = "Timeout";
case 1: reasonMsg = "Leaving";
<a href="http://cityadspix.com/tsclick-MIQCWPUV-GECAQBFF?url=http%3A%2F%2Fwww.sotmarket.ru%2Fproduct%2Fbag_notebook_10_case_logic_vna-210.html&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&bt=20&pt=9<=2&tl=3&sa=mh&sa1=&sa2=&sa3=&sa4=&sa5=&im=ODI1LTAtMTQxNjY0NDEwOC0xNDIzMzQ3NQ%3D%3D&fid=NDQ1NzU2Nzc1&prdct=3f0e36073205&kw=case%202" target="_blank" alt="Case logic Netbook Attache 10.2" title="Case logic Netbook Attache 10.2" style="">case 2</a>: reasonMsg = "Kicked";
}
GetPlayerName(playerid, name, sizeof(name));
format(leaveMsg, sizeof(leaveMsg), "02[%d] 03*** %s has left the server. (%s)", playerid, name, reasonMsg);
IRC_GroupSay(groupID, IRC_CHANNEL, leaveMsg);*/
LastSeen(playerid); // LastSeen System
KillTimer(PingTimer[playerid]);
oplayers--;
if(OldCar[playerid] != INVALID_VEHICLE_ID) PassengerInCar[OldCar[playerid]][PassengerSeat[playerid]] = INVALID_PLAYER_ID;
Boombox[playerid] = 0;
BoomboxPlayer[playerid] = -1;
BoomboxStream[playerid] = 0;
bpos[playerid][0] = 0; bpos[playerid][1] = 0; bpos[playerid][2] = 0; bpos[playerid][3] = 0;
format(BoomboxURL[playerid], 256, "");
if(IsValidDynamicObject(BoomboxObject[playerid])) DestroyDynamicObject(BoomboxObject[playerid]);
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(BoomboxPlayer[i] == playerid)
{
BoomboxStream[i] = 0;
BoomboxPlayer[i] = -1;
StopAudioStreamForPlayer(i);
SendClientMessage(i, COLOR_GREY, " The boombox creator has disconnected from the server.");
}
}
}
DestroyDynamic3DTextLabel(ado[playerid]);
DestroyDynamic3DTextLabel(ame[playerid]);
amestatus[playerid] = 0;
adostatus[playerid] = 0;
if(IsPlayerCuffed(playerid))
{
new string[128];
GetPlayerPos(playerid, PlayerInfo[playerid][pX], PlayerInfo[playerid][pY], PlayerInfo[playerid][pZ]);
ClearZaiatWantedLevels(playerid);
SetPlayerColor(playerid, TRANSPARENT_ORANGE);
PlayerInfo[playerid][pPrison] = 2;
PlayerInfo[playerid][pPrisonTime] = 10*60;
format(PlayerInfo[playerid][pPrisonReason], 64, "Avoid to Arrest");
format(PlayerInfo[playerid][pPrisonBy], 32, "AutoPrison");
SetPlayerInterior(playerid, 2);
SetPlayerVirtualWorld(playerid, 1);
new RandomCell = random(sizeof(RandomPrison));
SetPlayerFacingAngle(playerid, RandomPrison[RandomCell][3]);
TogglePlayerControllable(playerid, 0);
SetTimerEx("EnterExitTimer", 5000, false, "i", playerid);
SetPlayerPos(playerid, RandomPrison[RandomCell][0], RandomPrison[RandomCell][1], RandomPrison[RandomCell][2]);
SetCameraBehindPlayer(playerid);
format(string, sizeof(string), "{FF0000}[Admin]{FF6347} %s has been auto-prisoned, reason: Avoid to Arrest", RPN(playerid));
SendClientMessageToAll(COLOR_LIGHTRED, string);
Log("logs/prison.log", string);
format(string, sizeof(string), " You have been auto-prisoned for %d minutes (%d seconds)", PlayerInfo[playerid][pPrisonTime]/60, PlayerInfo[playerid][pPrisonTime]);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
There's more code underneath, but that shouldn't be necessary, that's just for ending any jobs he was doing and stuff like robberies