PDA

View Full Version : need help with INI_String


mineralo
19/06/2012, 02:42 PM
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
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?

Skaizo
19/06/2012, 03:04 PM
try

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;
}

mineralo
19/06/2012, 03:08 PM
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!");

mineralo
19/06/2012, 03:21 PM
any one else?

[MM]RoXoR[FS]
19/06/2012, 03:59 PM
Show line 9294

mineralo
19/06/2012, 05:37 PM
RoXoR[FS];1933002']Show line 9294

INI_String("IP",ip,128); // line: 9294

mineralo
19/06/2012, 10:24 PM
any one? any ideas? and who made y_ini system should know the solution