#1

Hello guys, the cmd always returns a message "Player is not found in the database." even when the player does exist.


PHP код:
UserPath(playerid)
{
    new 
string[75], pName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
    
format(stringsizeof string"/Users/%s.txt"pName);
    return 
string;

PHP код:
CMD:unban(playeridparams[])
{
    if(
PlayerInfo[playerid][AdminLevel] < 1) return 0;
    if(
PlayerInfo[playerid][AdminLevel] < 2) return SendClientMessage(playeridCOLOR_YELLOWGREEN"Error: You are not authorized to use this command.");
    new 
string[75], user[128];
    if(
sscanf(params"s[128]"user)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /unban [playername]");
    
format(stringsizeof string"/Users/%s.txt"user);
    if(
fexist(user))
    {
        new 
INI:File INI_Open(user);
        
printf("Userfile opened");
        
INI_SetTag(File"PlayerData");
        
INI_WriteInt(File"Banned"0);
        
printf("User unbanned");
        
INI_Close(File);
        
printf("File closed");
        
format(stringsizeof string"You have succesfully unbanned the player.");
        
SendClientMessage(playeridCOLOR_YELLOWstring);
    }
    else
    {
        
SendClientMessage(playeridCOLOR_RED"Error: The user is not found in the database!");
    }
    return 
1;

Reply
#2

Replace
PHP код:
if(fexist(user)) 
With:
PHP код:
if(fexist(string)) 
Reply
#3

Thanks,
How do I add that, when the variable Banned == 0, it returns a message "player is not banned".
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)