Posts: 28
Threads: 7
Joined: May 2009
Reputation:
0
Hello.
I have a file (bans.txt), I'm new to scripting (files at least), I need to remove a value (an IP) from that file, I was wondering how, and what to use?
*The file includes many other lines, so I'm not sure how to make it check, remove then done?
Thanks for any help, truly appreciated
Posts: 6,129
Threads: 36
Joined: Jan 2009
I was trying to make an unban command for myself, but I failed:
pawn Код:
dcmd_unban(playerid, params[])
{
new name[MAX_PLAYER_NAME], string[128], string2[128];
if (sscanf(params, "s", name))
{
SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /unban [name]");
SendClientMessage(playerid, COLOR_GREY, "Full name, this includes underscores.");
}
else
{
format(string, sizeof(string), "CRP_Scriptfiles/Accounts/%s.ini", name);
if(fexist(string))
{
dini_IntSet(string, "Banned", -1);
string2 = dini_Get(string, "IP");
fdeleteline("Bans.txt", string2);
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Invalid name, the name was not recognized.");
}
}
}
Errors:
C:\Documents and Settings\Calon\Desktop\SAMP\0.3\gamemodes\crpnew.p wn(20457) : error 047: array sizes do not match, or destination array is too small
Line 20457:
pawn Код:
string2 = dini_Get(string, "IP");
Can someone help me fix this, please?
Posts: 96
Threads: 1
Joined: Jun 2008
Reputation:
0
Calgon why make a seperate ban file. Use samp.ban. When you do /unban it loads the ip from the account file and sends the rcon command "unbanip ip".
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by TimmehBoy
Calgon why make a seperate ban file. Use samp.ban. When you do /unban it loads the ip from the account file and sends the rcon command "unbanip ip".
|
I prefer having a seprate file, the samp.ban prevents connecting and I'd rather the server showed a ban reason message.
@ Gappy; I changed it to that then got 4 errors, changed to 256 and it works. Sorry, my bad.