20.07.2016, 12:29
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
if(!IsPlayerNPC(playerid))
{
if(pInfo[playerid][pLogged] == 1) { SaveStats(playerid); }
DestroyDynamic3DTextLabel(PlayerLabel[playerid]);
PlayersAlive--;
ResetVars(playerid);
DisconnectVars(playerid);
DeletePlayerTD(playerid);
new str[256];
switch(reason)
{
case 0: format(str,sizeof(str),"*"COL_GREEN" %s(%i) a iesit de pe server. Motiv: Timed Out",PlayerName(playerid),playerid);
case 1: format(str,sizeof(str),"*"COL_GREEN" %s(%i) a iesit de pe server. Motiv: Leaving",PlayerName(playerid),playerid);
case 2: format(str,sizeof(str),"*"COL_GREEN" %s(%i) a iesit de pe server. Motiv: Kicked/Banned",PlayerName(playerid),playerid);
}
SendMessageToAllAdmins(str,-1);
if(IsBeingSpeced[playerid] == 1)
{
foreach(Player,i)
{
if(spectatorid[i] == playerid)
{
TogglePlayerSpectating(i,false);
giveWeaponAllow[i] = 1;
}
}
}
}
return 1;
}
I need to return a value to if(!IsPlayerNPC(playerid)) because my Dynamicnametag is not deleting on leaving.