SA-MP Forums Archive
Return value - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Return value (/showthread.php?tid=612651)



Return value - Zeus666 - 20.07.2016

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    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 
0format(str,sizeof(str),"*"COL_GREEN" %s(%i) a iesit de pe server. Motiv: Timed Out",PlayerName(playerid),playerid);
            case 
1format(str,sizeof(str),"*"COL_GREEN" %s(%i) a iesit de pe server. Motiv: Leaving",PlayerName(playerid),playerid);
            case 
2format(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.


Re: Return value - Zeus666 - 20.07.2016

help ?


Re: Return value - Stinged - 20.07.2016

I don't get what you're asking.
If you want to destroy an NPC's dynamic 3D label, you need to do it outside of the !IsPlayerNPC check.

Also, don't bump before 24 hours.. The rules are there for a reason!


Re: Return value - Zeus666 - 20.07.2016

I use it for a player, not for NPC


PHP код:
if(pInfo[playerid][pLogged] == 1) { SaveStats(playerid); } 
               
DestroyDynamic3DTextLabel(PlayerLabel[playerid]); 
         
PlayersAlive--; 
          
ResetVars(playerid); 
        
DisconnectVars(playerid); 
        
DeletePlayerTD(playerid); 
i have no return there and when a player with ID 1 /quits, and another player connects and gets ID 1, his nametag get's overlayed to the last ID 1 player.