Unban With Y_INI
#1

pawn Код:
CMD:unban(playerid,params[])
{
    new name[MAX_PLAYER_NAME];
    if(!IsPlayerAdmin(playerid) && Player[playerid][Admin] < 7) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}You Have Entered An Invalid Command. Please Read {00FF00}/CMDS{FFFFFF}.");
    if(sscanf(params,"s[MAX_PLAYER_NAME]",name)) return SendClientMessage(playerid, red, "SYNTAX ERROR: {00FF00}/UNBAN {FFFF00}<PlayerName>");
    if(strlen(name) > 24) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}The Player Name Must Be Less Than 60 Characters Long.");
    new string[98];
    format(string,sizeof(string),"/Drifting/Users/%s.ini",name);
    new IsBanned;
    new INI:string["Account Data"](name[],value[])
    {
        INI_Int("Banned",);
    }
    if(IsBanned == 0) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Is Not Banned, Please Try Again.");
    if(!fexist(string)) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}Player File Does Not Exist, Please Note, Files Are {FFFF00}Case Sensitive{FFFFFF}.");
    new INI:File = INI_Open(string);
    INI_WriteInt(File,"Banned",0);
    INI_Close(File);
    format(string,sizeof(string),"Player Account %s Has Been Unbanned.",name);
    SendClientMessage(playerid, yellow, string);
    format(string,sizeof(string),"Administrator %s Has Unbanned The Player Account: %s.",pName(playerid),name);
    return 1;
}
Hey again guys, I'm having trouble with y_ini, how can I check if a Player's variable is set to 0 or not, and if it is, then return a message. If you look at the code above, you will see what I am trying to accomplish.

As you can see, these lines are what is hassling me:
pawn Код:
new IsBanned;
    new INI:string["Account Data"](name[],value[])
    {
        INI_Int("Banned",);
    }
    if(IsBanned == 0) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Is Not Banned, Please Try Again.");
Any help given is greatly appreciated.
Reply
#2

pawn Код:
new IsBanned[MAX_PLAYERS];
    new INI:string["Account Data"](name[],value[])
    {
        INI_Int("Banned",IsBanned[playerid]);
    }
    if(IsBanned[playerid] == 0) return SendClientMessage(playerid, red, "ERROR: {FFFFFF}This Player Account Is Not Banned, Please Try Again.");
...I'm not so sure cuz I didn't test it...but try this
Reply
#3

No, doesn't work. If anyone wants to know what errors I'm getting, I get these errors:
Код:
DriftStunt.pwn(1047) : error 001: expected token: "-identifier-", but found "forward"
DriftStunt.pwn(1049) : error 017: undefined symbol "value"
Line 1047 Being:
pawn Код:
new INI:string["Account Data"](name[],value[])
And Line 1049 Being:
pawn Код:
INI_Int("Banned",IsBanned[playerid]);
Reply
#4

forget an ; and don't defined symbom value what mean it doesn't exist, so watch for an ; and create new value;
Reply
#5

Not sure what you mean by that, if you know how to fix it, please add it into the code so I can understand how it's working.
Reply
#6

your never opening the file ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)