/unban Cmd question
#1

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;
}
Reply
#2

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;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)