03.04.2013, 06:55
How to load a string in y_ini from user files? I have this
It's an unban command. It's working fine. But the loadip part didn't work. It didn't load an ip from user's account.
pawn Код:
CMD:unban(playerid, params[])
{
new name[24],str[128];
if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, -1, ""herror" Usage: /unban [Player name]");
format(str,sizeof(str),UserPath,name);
if(!fexist(str)) return SendClientMessage(playerid, red, "Player is not banned/found!");
new INI:file = INI_Open(str);
INI_SetTag(file,"PlayerData");
INI_WriteInt(file,"Banned",0);
INI_Close(file);
INI_ParseFile(str, "loadip", .bExtra = true, .extra = playerid);
format(str,sizeof(str),""hpurple"* Admin %s(%d) has unbanned %s.", PlayerName(playerid),playerid,name);
foreach(new i: Player)
{
if(pInfo[i][Admin] >= 1)
{
SendClientMessage(i, -1, str);
}
}
return 1;
}
forward loadip(name[],value[]);
public loadip(name[],value[])
{
new ip[16], str[50];
INI_String("IP",ip,16);
SendClientMessageToAll(-1,"ip"); //debug
format(str,sizeof(str),"unbanip %s",ip);
SendRconCommand(str);
return 1;
}