SA-MP Forums Archive
/unban Cmd question - 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: /unban Cmd question (/showthread.php?tid=449174)



/unban Cmd question - Blackazur - 07.07.2013

Hello, when i use /unban cmd the variable "pBanned" will be reseting to 0 also unbanned, but it open a complete new file, it didnt write in the playerfile, how can i fix that?

Код:
CMD:unban(playerid, params[])
{
	if(pInfo[playerid][pLogged] == 1)
	{
		if(pInfo[playerid][pAdminLevel] >= 3)
		{
				new id, targetid, string[128];
				if(sscanf(params,"u", id)) return SendClientMessage(playerid, -1,""chat""COL_RED" Usage: /unban [playername]");
				else
				{
					SendClientMessage(playerid,-1,""chat""COL_RED" The user has been unbanned.");
                    format(string, 256, "/Users/%s.ini", targetid);
                    new INI:File = INI_Open(UserPath(playerid));
                    INI_SetTag(File,"data");
                    INI_WriteInt(File, "pBanned", 0);
                    INI_Close(File);
					pInfo[targetid][pBanned] = 0;
			    }
			    
	    }
	    	else {
		SendClientMessage(playerid,-1,""chat""COL_WHITE" SERVER: Unknown command.");
			}
	}
	else {
	    SendClientMessage(playerid,-1,""chat" You are not logged in!");
	    Kick(playerid);
	}
	return 1;
}



Re : /unban Cmd question - yusei - 07.07.2013

PHP код:
CMD:unban(playeridparams[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        if(
pInfo[playerid][pAdminLevel] >= 3)
        {
                new 
idtargetidstring[128];
                if(
sscanf(params,"u"id)) return SendClientMessage(playerid, -1,""chat""COL_RED" Usage: /unban [playername]");
                else
                {
                    
SendClientMessage(playerid,-1,""chat""COL_RED" The user has been unbanned.");
                    
pInfo[targetid][pBanned] = 0;
                    
format(string256"/Users/%s.ini"targetid);
                    new 
INI:File INI_Open(UserPath(playerid));
                    
INI_SetTag(File,"data");
                    
INI_WriteInt(File"pBanned"0);
                    
INI_Close(File);
                
                }
                
        }
            else {
        
SendClientMessage(playerid,-1,""chat""COL_WHITE" SERVER: Unknown command.");
            }
    }
    else {
        
SendClientMessage(playerid,-1,""chat" You are not logged in!");
        
Kick(playerid);
    }
    return 
1;