SA-MP Forums Archive
need help with INI_String - 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: need help with INI_String (/showthread.php?tid=352334)



need help with INI_String - mineralo - 19.06.2012

well, at moment I use y_ini system of saving stuff, I wanted make a simple ban and unban system for my server but when I want to unban ip from rcon cmd I get 2 error of getting the ip
pawn Код:
if(strcmp(cmd,"/unban",true) == 0)
    {
        new string[256],ip[128];
        if(GetPlayerAdminz(playerid) < 1) return 0;
        new length = strlen(cmdtext);
        while ((idx < length) && (cmdtext[idx] <= ' '))
        {
        idx++;
        }
        new offset = idx;
        new result[256];
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
        result[idx - offset] = cmdtext[idx];
        idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result))return SendClientMessage(playerid, COLOR_WHITE, "( ! ) /unban (name)");
        if(fexist(result))
        {
        new INI:File = INI_Open(result);
        INI_String("IP",ip,128); // line: 9294
        INI_Close(File);
        format(string,sizeof(string),"unbanip %s",ip);
        SendRconCommand(string);
        SendRconCommand("reloadbans");
        format(string,sizeof(string),"( ! ) %s has been unbanned by %s.",result,PlayerName(playerid));
        MessageToAdmins(COLOR_RED,string);
        }
        else
        {
        scm(playerid,c_r,"( ! ) This player not exist !");
        }
        return 1;
    }
Код:
D:\Programs\proecte ne terminate\samp\gamemodes\rpg.pwn(9294) : error 017: undefined symbol "name"
D:\Programs\proecte ne terminate\samp\gamemodes\rpg.pwn(9294) : error 017: undefined symbol "value"
the line get error that of INI_String
any one know what its wrong?


Re: need help with INI_String - Skaizo - 19.06.2012

try
pawn Код:
if(strcmp(cmd,"/unban",true) == 0)
    {
        new string[256], ip[128], result[128], unban[128];
        if(!IsPlayerConnect(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected!");
        if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTRED, "You are not authorized to use this command!");
        if(!strlen(result))return SendClientMessage(playerid, COLOR_WHITE, "( ! ) /unban (name)");
        if(sscanf(params, "s[128]", unban)) return SendClientMessage(playerid, COLOR_WHITE, "CMD: /unban [Full Player Name]");
        if(fexist(result))
        {
        new INI:File = INI_Open(result);
        INI_String("IP",ip,128); // line: 9294
        INI_Close(File);
        format(string,sizeof(string),"unbanip %s",ip);
        SendRconCommand(string);
        SendRconCommand("reloadbans");
        format(string,sizeof(string),"( ! ) %s has been unbanned by %s.",result,PlayerName(playerid));
        MessageToAdmins(COLOR_RED,string);
        }
        return 1;
    }



Re: need help with INI_String - mineralo - 19.06.2012

same problem, and some of stuff which you written is useless, like
Код:
if(!IsPlayerConnected(playerid)) return SendClientMessage(playerid, COLOR_WHITE, "This player is not connected!");



Re: need help with INI_String - mineralo - 19.06.2012

any one else?


Re: need help with INI_String - [MM]RoXoR[FS] - 19.06.2012

Show line 9294


Re: need help with INI_String - mineralo - 19.06.2012

Quote:
Originally Posted by [MM]RoXoR[FS]
Посмотреть сообщение
Show line 9294
Код:
INI_String("IP",ip,128); // line: 9294



Re: need help with INI_String - mineralo - 19.06.2012

any one? any ideas? and who made y_ini system should know the solution