29.09.2018, 05:24
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new name[MAX_PLAYER_NAME], tname[MAX_PLAYER_NAME], targetid, money = GetPlayerMoney(playerid);
GetPlayerName(playerid, name, sizeof(name));
GetPlayerName(targetid, tname, sizeof(tname));
switch(reason)
{
case 0: // Timeout / Crashed
{
if(rp[playerid] == 1 || rp1[targetid] ==1)
{
if(pInfo[targetid][pWallet] == 0)
{
new string [200];
format(string,sizeof(string), "You've recovered your wallet(0$). Reason: %s(%d) has crashed.", name, playerid);
SendClientMessage(playerid, -1, string);
pInfo[targetid][pWallet] = 1;
pInfo[playerid][pWallet] = 0;
pInfo[playerid][pCash] = 0;
} else return 1;
}
return 1;
}
case 1: // Left
{
if(rp[playerid] == 1 || rp1[targetid] ==1)
{
if(pInfo[targetid][pWallet] == 0)
{
new string [200];
format(string,sizeof(string), "You've recovered your wallet(0$). Reason: %s(%d) has left.", name, playerid);
SendClientMessage(playerid, -1, string);
pInfo[targetid][pWallet] = 1;
pInfo[playerid][pWallet] = 0;
pInfo[playerid][pCash] = 0;
} else return 1;
}
}
case 2: // Kicked / Banned
{
if(rp[playerid] == 1 || rp1[targetid] ==1)
{
if(pInfo[targetid][pWallet] == 0)
{
new string [200];
GivePlayerMoney(targetid, money);
GivePlayerMoney(playerid, -money);
format(string,sizeof(string), "You've recovered your wallet(%d$). Reason: %s(%d) has been kicked/banned.", name, playerid, money);
SendClientMessage(playerid, -1, string);
pInfo[targetid][pWallet] = 1;
pInfo[playerid][pWallet] = 0;
pInfo[playerid][pCash] = 0;
} else return 1;
}
}
}
SaveStats(playerid);
return 1;
}