Yini read
#1

Can someone tell me how to fix this, how to read from the // file

PHP Code:
CMD:unban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return 0;
    if(
PlayerInfo[playerid][pAdmin] < 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(string))
    {
        new 
INI:File INI_Open(string);
      
//  if(INI_WriteInt(File, "Banned", PlayerInfo[string][Banned]) == 0) return SendClientMessage(playerid, COLOR_RED, "Error: The player is not banned!");
        
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

Similair
http://forum.sa-mp.com/showpost.php?...75&postcount=4
Reply
#3

I am sorry, but I still don't manage to fix it.
Reply
#4

I have the same problem,and I think it's impossible to get value of offline player and compare it with another value.Am I right?
Reply
#5

Quote:
Originally Posted by StreetboyBalkan
View Post
I have the same problem,and I think it's impossible to get value of offline player and compare it with another value.Am I right?
I think it's not impossible, but we just don't know it yet, Lets wait for some answers.
Reply
#6

anyone knows?
Reply
#7

BUMP!
Reply
#8

Quote:
Originally Posted by saffierr
View Post
Can someone tell me how to fix this, how to read from the // file

PHP Code:
CMD:unban(playeridparams[])
{
    if(
PlayerInfo[playerid][pAdmin] < 1) return 0;
    if(
PlayerInfo[playerid][pAdmin] < 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(string))
    {
        new 
INI:File INI_Open(string);
      
//  if(INI_WriteInt(File, "Banned", PlayerInfo[string][Banned]) == 0) return SendClientMessage(playerid, COLOR_RED, "Error: The player is not banned!");
        
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;

Change
PHP Code:
//  if(INI_WriteInt(File, "Banned", PlayerInfo[string][Banned]) == 0) return SendClientMessage(playerid, COLOR_RED, "Error: The player is not banned!");
if(INI_Int("Banned",PlayerInfo[string][Banned])
//Close File
//Now Check The Variable
If(PlayerInfo[string][Banned] == 0) return SendClientMessage(playeridCOLOR_RED"Error: The player is not banned!"); 
Reply
#9

I showed you how to do it in first post
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)