What's wrong
#1

What's wrong, I want to read a file from 'Banned'.

PHP код:
CMD:ewa(playeridparams[])
{
    
INI:UserPath(playerid)[](name[], value[])
    {
        
INI_String("Banned"PlayerInfo[playerid][Banned]);
    }
    
INI_Load("UserPath.ini");
    return 
1;

Quote:

error 029: invalid expression, assumed zero
error 017: undefined symbol "@INI_UserPath"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line

Reply
#2

PHP код:
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;

Add this in your script
Reply
#3

I've got this already.

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

Reply
#4

Anyone ?
Reply
#5

Solution:-
PHP код:
CMD:ewa(playeridparams[])
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_WriteInt(File,"Banned"PlayerInfo[playerid][Banned]);
    
INI_Close(File);
    return 
1;

Reply
#6

I think you didn't quite understand the question.
My question is, How can I read the variable from "Banned"?
I mean if "Banned" is 0, I want to check that and return a message "player is not banned".
Reply
#7

PHP код:
CMD:ewa(playeridparams[])
{
    if(
PlayerInfo[playerid][Banned] == 1)
    {
        
SendClientMessage(playerid, -1"{FF0000}You're banned!");
    }
    else if(
PlayerInfo[playerid][Banned] == 0)
    {
        
SendClientMessage(playerid, -1"{FF0000}You're not banned!");
    }
    return 
1;


Just do this.
Reply
#8

Lol, I appreciate it that you're trying to help me, but yet again, I mean if someone is offline. You can't unban a online player
Reply
#9

Quote:
Originally Posted by saffierr
Посмотреть сообщение
Lol, I appreciate it that you're trying to help me, but yet again, I mean if someone is offline. You can't unban a online player
I don't understand what you want exactly please explain more.
Reply
#10

How to read from the file 'Banned' to check wether the variable is (1 = banned) (0 = not banned).

PHP код:
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;

The // line is incorrect, that's why I ask it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)