SA-MP Forums Archive
Yini read - 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: Yini read (/showthread.php?tid=601320)



Yini read - saffierr - 19.02.2016

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;




Re: Yini read - Jefff - 19.02.2016

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


Re: Yini read - saffierr - 19.02.2016

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


Re: Yini read - StreetboyBalkan - 19.02.2016

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?


Re: Yini read - saffierr - 19.02.2016

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.


Re: Yini read - StreetboyBalkan - 21.02.2016

anyone knows?


Re: Yini read - StreetboyBalkan - 23.02.2016

BUMP!


Re: Yini read - Amunra - 23.02.2016

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!"); 



Re: Yini read - Jefff - 23.02.2016

I showed you how to do it in first post