y_ini - reading something dosent work
#1

Ey guys yea i was converting all this dini crap to y_ini and suddenly i created a ban command which fails in loading...

D:

Heres my code:
OnPlayerConnect:
pawn Code:
public OnPlayerConnect(playerid)
{
    if(INI_Exist(INI_BAN_FILE, ReturnPlayerName(playerid)))
    {
        ShowBan(playerid);
        return 0;
    }
        return 1;
}
The showban function:
pawn Code:
stock ShowBan(playerid)
{
    new file[64], string[256];
    format(file, sizeof(file), INI_BAN_FILE, ReturnPlayerName(playerid));
    INI_ParseFile(file, "LoadBannedUser", false, true, playerid, true, false);
    format(string, 256, "You are banned from this server. If you've feel you have been wrongfully ban please reply at "#SERVER_WEBSITE"\n\n"COL_RED"BANNED BY: %s\nBANNED DATE: %s\nBANNED TIME: %s\nBANNED REASON: %s", GetPVarInt(playerid, "bPlayer"),GetPVarInt(playerid, "bDate"),GetPVarInt(playerid, "Time"),GetPVarInt(playerid, "bReason"));
    ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "Call of Duty: Blackops", string, "Ok", "");
    Kick(playerid);
}
LoadBannedUser callback:
pawn Code:
forward LoadBannedUser(playerid, name[], value[]);
public LoadBannedUser(playerid, name[], value[])
{
    if (!strcmp(name, "BAN_REASON")) {
        SetPVarString(playerid, "bReason", value);
    }
    if (!strcmp(name, "BAN_DATE")) {
        SetPVarString(playerid, "bDate", value);
    }
    if (!strcmp(name, "BAN_TIME")) {
        SetPVarString(playerid, "bTime", value);
    }
    if (!strcmp(name, "BAN_BY")) {
        SetPVarString(playerid, "bPlayer", value);
    }
}
This is how it looks like when i ban my self(the player file)
Code:
BAN_IP = 5.57.93.125
BAN_REASON = hello lets test
BAN_DATE = 11/January/2011
BAN_TIME = 16/33/19
BAN_BY = Lorenc
All of this ends up to:


WELP!

-Lorenc_
Reply
#2

I am lol'ing but sucks i don't know how to use y_ini D:
Reply
#3

D: you really are bored, i can tell.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)