01.08.2013, 12:33
pawn Код:
[12:23:49] [debug] #0 0007387c in public Streamer_OnPlayerDisconnect (0x00000008, 0x00000000) from script.amx
[12:23:49] [debug] #1 native CallLocalFunction () [00471e90] from samp-server.exe
[12:23:49] [debug] #2 0000e1e8 in public FIXES_OnPlayerDisconnect (0x00000008, 0x00000000) from script.amx
[12:23:49] [debug] #3 00000e58 in public OnPlayerDisconnect (0x00000008, 0x00000000) from script.amx
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
Kicked[playerid] = false;
KillTimer(CPTimer[playerid]); KillTimer(SpawnTimer[playerid]);
// ResetPlayerPropertyInfo(playerid, reason);
KillTimer(PlayerTemp[playerid][DropTimer]);
KillTimer(PlayerTemp[playerid][RobTimer]);
KillTimer(PlayerTemp[playerid][RobBizTimer]);
KillTimer(PlayerTemp[playerid][lictimer]);
new Float:pposX, Float:pposY, Float:pposZ;
GetPlayerPos(playerid, pposX, pposY, pposZ);
dUserSet(PlayerName(playerid)).("lastonline",TimeDate());
for(new x=0; x<MAX_PLAYERS; x++)
{
if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && gSpectateID[x] == playerid) AdvanceSpectate(x);
}
new playername[MAX_PLAYER_NAME];
new str[MAX_STRING];
// if(namesenable == 1 && NickCheck(playerid,0)) return 1;
switch (reason)
{
case 0:
{
//IRC_Quit(iBots[playerid], "Crashed");
GetPlayerName(playerid, playername, 30);
format(str, 256, "[PART] %s has left the server (Timeout)", playername);
for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerTemp[i][jqmessage]) SendClientMessage(i,COLOR_LIGHTGREY, str);
format( str, sizeof(str), "14[QUIT] %s[%d] has left SS:RP. (Timeout)",PlayerName(playerid), playerid);
iEcho( str );
// format( str, sizeof(str), "14[QUIT] %s[%d] has disconnected. (Timeout)",PlayerName(playerid), playerid);
// iEcho( str );
format(str, sizeof(str), "# [%s] %s %s has logged out (Timeout/Crash)", PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][rankname], RPName(playerid));
if(PlayerInfo[playerid][playerteam] != CIV) SendClientMessageToTeam(PlayerInfo[playerid][playerteam],str,COLOR_PLAYER_VLIGHTBLUE);
//new ragione[20]="Timeout";
//ircecho("quit %d %s %s",playerid,PlayerName(playerid),ragione);
dUserSetFLOAT(PlayerName(playerid)).("crashX", pposX);
dUserSetFLOAT(PlayerName(playerid)).("crashY", pposY);
dUserSetFLOAT(PlayerName(playerid)).("crashZ", pposZ);
dUserSetINT(PlayerName(playerid)).("crashINT", GetPlayerInterior(playerid));
dUserSetINT(PlayerName(playerid)).("crashVW", GetPlayerVirtualWorld(playerid));
}
case 1:
{
//IRC_Quit(iBots[playerid], "Left");
GetPlayerName(playerid, playername, 30);
format(str, 256, "[PART] %s has left the server (Leaving)", playername);
for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerTemp[i][jqmessage]) SendClientMessage(i,COLOR_LIGHTGREY, str);
format( str, sizeof(str), "14[QUIT] %s[%d] has left SS:RP. (Leaving)",PlayerName(playerid), playerid);
iEcho( str );
// format( str, sizeof(str), "14[QUIT] %s[%d] has disconnected. (Leaving)",PlayerName(playerid), playerid);
// iEcho( str );
format(str, sizeof(str), "# [%s] %s %s has logged out (Leaving)", PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][rankname], RPName(playerid));
if(PlayerInfo[playerid][playerteam] != CIV) SendClientMessageToTeam(PlayerInfo[playerid][playerteam],str,COLOR_PLAYER_VLIGHTBLUE);
//new ragione[20]="Leaving";
//ircecho("quit %d %s %s",playerid,PlayerName(playerid),ragione);
dUserSetFLOAT(PlayerName(playerid)).("crashX", 0.0);
dUserSetFLOAT(PlayerName(playerid)).("crashY", 0.0);
dUserSetFLOAT(PlayerName(playerid)).("crashZ", 0.0);
dUserSetINT(PlayerName(playerid)).("crashINT", 0);
dUserSetINT(PlayerName(playerid)).("crashVW", 0);
}
case 2:
{
//IRC_Quit(iBots[playerid], "Kicked");
GetPlayerName(playerid, playername, 30);
format(str, 256, "[PART] %s has left the server (Kicked/Banned)", playername);
for(new i=0;i<MAX_PLAYERS;i++) if(IsPlayerConnected(i) && PlayerTemp[i][jqmessage]) SendClientMessage(i,COLOR_LIGHTGREY, str);
format( str, sizeof(str), "14[QUIT] %s[%d] has left SS:RP. (Kicked/Banned)",PlayerName(playerid), playerid);
iEcho( str );
// format( str, sizeof(str), "14[QUIT] %s[%d] has disconnected. (Kicked/Banned)",PlayerName(playerid), playerid);
// iEcho( str );
format(str, sizeof(str), "# [%s] %s %s has logged out (Kicked/Banned)", PlayerInfo[playerid][PTeamName],PlayerInfo[playerid][rankname], RPName(playerid));
if(PlayerInfo[playerid][playerteam] != CIV) SendClientMessageToTeam(PlayerInfo[playerid][playerteam],str,COLOR_PLAYER_VLIGHTBLUE);
//new ragione[20]="Kicked";
//ircecho("quit %d %s %s",playerid,PlayerName(playerid),ragione);
dUserSetFLOAT(PlayerName(playerid)).("crashX", 0.0);
dUserSetFLOAT(PlayerName(playerid)).("crashY", 0.0);
dUserSetFLOAT(PlayerName(playerid)).("crashZ", 0.0);
dUserSetINT(PlayerName(playerid)).("crashINT", 0);
dUserSetINT(PlayerName(playerid)).("crashVW", 0);
}
}
new wat[ 40 ];
if(reason == 0) myStrcpy(wat, "Timeout");
else if(reason == 1) myStrcpy(wat, "Leaving");
else myStrcpy(wat, "Kicked/Banned");
format(str, sizeof(str), "(( Local: %s[%d] has left the server [%s] ))", RPName(playerid), playerid, wat);
NearMessage(playerid,str,COLOR_LIGHTGREY);
GetPlayerName(playerid, playername, sizeof(playername));
if(PlayerFighting[playerid] > 0)
{
if(fighter1 == playerid)
{
if(IsPlayerConnected(fighter2))
{
PlayerFighting[fighter2] = 0;
SetPlayerPosEx(playerid, 758.3981,-68.1611,1000.8479, 7, 1338);
SetPlayerInterior(fighter2, 5);
GameTextForPlayer(fighter2, "~r~Match interupted", 5000, 1);
GivePlayerMoneyEx(fighter2,fightmoney/2);
PlayerFighting[fighter2] = 0;
fight = 0;
lost = 0;
SetPlayerPosEx(playerid, 758.3981,-68.1611,1000.8479, 7, 1338);
SetPlayerHealth(fighter2, 98);
}
}
else if(fighter2 == playerid)
{
if(IsPlayerConnected(fighter1))
{
PlayerFighting[fighter1] = 0;
SetPlayerPosEx(playerid, 758.3981,-68.1611,1000.8479, 7, 1338);
GameTextForPlayer(fighter1, "~r~Match interupted", 5000, 1);
GivePlayerMoneyEx(fighter1,fightmoney/2);
PlayerFighting[fighter1] = 0;
fight = 0;
lost = 0;
SetPlayerPosEx(playerid, 758.3981,-68.1611,1000.8479, 7, 1338);
SetPlayerHealth(fighter1, 98);
}
}
fighter1 = 555;
fighter2 = 555;
}
if(debuglvl>=3)
{
new dbg[MAX_STRING]; format(dbg,sizeof(dbg),"[DEBUG] %s(%d) Disconnected, Saving Data - DBG [%d]",PlayerName(playerid),playerid,debuglvl);
Debug(dbg);
}
if(cuffed[playerid] && reason == 1)
{
PlayerInfo[playerid][jail]=1;
PlayerInfo[playerid][jailtime]=1800;
PlayerInfo[playerid][bail]=777;
myStrcpy(PlayerInfo[playerid][jailreason], "/q arrest");
//ircecho("unformatted %s(%d) autojailed 600 seconds for /q to avoid arrest",PlayerName(playerid),playerid);
new avoid[MAX_STRING];
format(avoid,sizeof(avoid),"[QUITJAIL] %s got 30 minutes of autojail for quitting during arrest.",PlayerName(playerid));
SendClientMessageToAll(0xCCFFCC00,avoid);
cuffed[playerid] = 0;
}
if (PLAYERLIST_authed[playerid])
{
for(new q; q < sizeof(Seeds); q++) if(!strcmp(PlayerName(playerid), Seeds[q][sOwner], false)) ResetSeed(q);
File::SaveAccount(playerid);
myStrcpy(PlayerTemp[playerid][IP],"0.0.0.0");
PlayerInfo[playerid][tbanned]=0;
PlayerTemp[playerid][seeds]=0;
PlayerInfo[playerid][playerteam]=CIV;
myStrcpy(PlayerInfo[playerid][PTeamName],"Civilian");
SetPlayerWantedLevel(playerid,0);
PlayerInfo[playerid][playerlvl]=0;
PlayerTemp[playerid][GYM_CURDONE] = 0;
PlayerTemp[playerid][mutedtick] = 0;
PlayerInfo[playerid][playerBarrierKeys]=0;
SetPlayerMoney(playerid,0);
PlayerTemp[playerid][sm]=0;
PlayerInfo[playerid][jail]=0;
PlayerInfo[playerid][jailtime]=0;
PlayerInfo[playerid][power]=0;
PlayerInfo[playerid][banned]=0;
PlayerInfo[playerid][factnumber]=-1;
PlayerInfo[playerid][rpoints]=0;
PlayerTemp[playerid][tokick]=0;
PlayerInfo[playerid][ranklvl]=-1;
PlayerInfo[playerid][rentprice]=0;
PlayerInfo[playerid][spawnX]=0.0;
PlayerInfo[playerid][spawnY]=0.0;
PlayerTemp[playerid][deposited]=0;
PlayerInfo[playerid][spawnZ]=0.0;
PlayerInfo[playerid][spawnInter]=0;
PlayerInfo[playerid][playertime]=0;
PlayerInfo[playerid][driverlic]=0;
PlayerInfo[playerid][phonenumber]=0;
PlayerInfo[playerid][famnumber]=-1;
PlayerInfo[playerid][boatlic]=0;
PlayerInfo[playerid][Skin]=170;
PlayerInfo[playerid][head]=0;
PlayerInfo[playerid][playertime]=0;
PlayerInfo[playerid][flylic]=0;
PlayerInfo[playerid][female]=0;
PlayerInfo[playerid][sdrugs]=0;
PlayerInfo[playerid][guns]=0;
PlayerInfo[playerid][bank]=0;
PlayerTemp[playerid][oocmode] = 0;
PlayerTemp[playerid][wlock]=0;
SetPlayerScore(playerid,0);
SetPlayerScore(playerid,0);
PlayerTemp[playerid][muted]=0;
PlayerInfo[playerid][laptop]=0;
PlayerInfo[playerid][driverlic]=0;
PlayerInfo[playerid][weaplic]=0;
PlayerInfo[playerid][flylic]=0;
PlayerInfo[playerid][virworld]=0;
PlayerInfo[playerid][age]=25;
PlayerInfo[playerid][playerdj]=0;
PlayerTemp[playerid][phoneoff]=0;
PlayerTemp[playerid][oocoff]=0;
PlayerInfo[playerid][premium]=0;
PlayerInfo[playerid][radio]=0;
PlayerInfo[playerid][freq1]=INVALID_RADIO_FREQ;
PlayerInfo[playerid][freq2]=INVALID_RADIO_FREQ;
PlayerInfo[playerid][freq3]=INVALID_RADIO_FREQ;
PlayerTemp[playerid][tmphouse]=-1;
myStrcpy(PlayerInfo[playerid][TeamRankName],"Civ");
myStrcpy(PlayerInfo[playerid][playerteamname],"playerteamname");
myStrcpy(PlayerInfo[playerid][married],"Not married");
myStrcpy(PlayerInfo[playerid][faction],"None");
myStrcpy(PlayerInfo[playerid][city],"Las Venturas");
myStrcpy(PlayerInfo[playerid][job],"None");
myStrcpy(PlayerInfo[playerid][family],"None");
PlayerTemp[playerid][jqmessage]=0;
PlayerTemp[playerid][hname]=0;
PlayerTemp[playerid][playertosms]=666;
PlayerTemp[playerid][onphone] = -1;
PlayerTemp[playerid][onload] = -1;
PlayerTemp[playerid][adminduty] = 0;
PlayerTemp[playerid][copduty] = 0;
PlayerTemp[playerid][adminspy] = 0;
PlayerTemp[playerid][admincmdspy] = 0;
PlayerTemp[playerid][deathX] = 0.0;
PlayerTemp[playerid][deaded] = 0;
PlayerTemp[playerid][deathY] = 0.0;
PlayerTemp[playerid][deathZ] = 0.0;
PlayerTemp[playerid][deathINT] = 0;
PlayerTemp[playerid][deathVW] = 0;
PlayerInfo[playerid][totalruns] = 0;
PlayerTemp[playerid][givefpay] = 0;
PlayerInfo[playerid][fpay] = 0;
PlayerInfo[playerid][fights] = 0;
PlayerTemp[playerid][canrob] = 0;
PlayerTemp[playerid][spawnrdy] = 0;
PlayerTemp[playerid][WrongPass] = 0;
PlayerTemp[playerid][onpaint] = 0;
PlayerTemp[playerid][isevent] = 0;
PlayerTemp[playerid][pbteam] = 0;
PlayerTemp[playerid][fishamount] = 0;
PlayerTemp[playerid][totalfish] = 0;
PlayerTemp[playerid][totalrob] = 0;
PlayerTemp[playerid][killedby] = INVALID_PLAYER_ID;
PlayerTemp[playerid][weaponome]=-1;
PlayerTemp[playerid][totalguns] = 0;
iconcount[playerid]=0;
PlayerInfo[playerid][helper]=0;
cuffed[playerid] = 0;
tazed[playerid] = 0;
isCCTV[playerid] = 0;
PlayerTemp[playerid][WrongPass] = 0;
PlayerTemp[playerid][imprisoned] = 0;
PlayerTemp[playerid][onload] = -1;
if(treadmillBUSY == playerid) treadmillBUSY = -1;
if(PlayerTemp[playerid][phone]==1)
{
SendClientMessage(PlayerTemp[playerid][onphone], COLOR_PLAYER_DARKYELLOW,"Phone Connection Lost");
PlayerTemp[playerid][phone]= 0;
PlayerTemp[PlayerTemp[playerid][onphone]][phone]= 0;
PlayerTemp[PlayerTemp[playerid][onphone]][onphone] = -1;
PlayerTemp[playerid][onphone] = -1;
}
if(IsValidMenu(Menu:lapmenu[playerid][PlayerInfo[playerid][playerteam]])) DestroyMenu(lapmenu[playerid][PlayerInfo[playerid][playerteam]]);
//if(PlayerTemp[playerid][carbuy]) DeleteCar(PlayerTemp[playerid][carbuy],playerid);
//if(PlayerTemp[playerid][pvehicle]) DeleteCar(PlayerTemp[playerid][pvehicle],playerid);
if(PlayerTemp[playerid][rentcar]!=0)
{
UnlockVehicle(PlayerTemp[playerid][rentcar]);
PlayerTemp[playerid][rentcar]=0;
}
if(IsPlayerInPaintball(playerid))
{
if(PlayerTemp[playerid][pbteam] == 1) PBTeams[PlayerTemp[playerid][onpaint]][redteamcount]--;
else PBTeams[PlayerTemp[playerid][onpaint]][blueteamcount]--;
}
}
PLAYERLIST_authed[playerid]=false;
if(debuglvl>=3){
new dbg[MAX_STRING]; format(dbg,sizeof(dbg),"[DEBUG] %s(%d) Data succesfully saved - DBG [%d]",PlayerName(playerid),playerid,debuglvl);
Debug(dbg);
}
return 1;
}