/unban Command - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /unban Command (
/showthread.php?tid=138002)
/unban Command -
andyF - 31.03.2010
Код:
if (strcmp(cmd, "/unban", true)==0)
{
if((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >=4)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_WHITE, "USAGE: /unban [PlayerName_LastName]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(giveplayer));
format(string, 256, "AdmWarning: %s has unbanned account %s", sendername, tmp);
ABroadCast(COLOR_YELLOW,string,1);
format(string, 256, "AdmWarning: %s has unbanned account %s", sendername, tmp);
printf(string);
format(string,sizeof(string),"users/%s.ini",tmp);
dini_IntSet(string, "Banned", 0);
dini_IntSet(string, "Warnings", 0);
SendClientMessage(playerid, COLOR_WHITE, "Player Unbanned");
SendRconCommand(string);
SendRconCommand("reloadbans");
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
}
return 1;
}
I am trying to script /unban command that would unban a player using his FirstName_LastName format, and would also set his warnings to 0 and set his banned status to 0. The command happens to work fine, however it messes up the Userfile format. If I unban anyone using this command it will mess up the userfile. For Example: On GodFather Script, we all know that Userfile functions come one after the one .. Like this: Level=1AdminLevel=0(and whatsoever). If I use /unban it will bug the account and change the format to this...
Level=1
AdminLevel=0
(and all other functions).
I have no clue what's causing this. Anyone experienced this problem before and fixed it? if so please help.
Re: /unban Command -
jaheem - 31.03.2010
same porblem
Re: /unban Command -
andyF - 31.03.2010
Any suggestions?
Re: /unban Command -
andyF - 01.04.2010
Would be nice if someone help? I really need help.
Re: /unban Command -
Postalityjr - 01.04.2010
Maybe its the script your using? Some scripts may already have an unban command?
Re: /unban Command -
Outbreak - 01.04.2010
I used to use that method for user files, I did manage to write an /unban [name] command. It worked perfect in windows but often crashed the server in Linux.
I think it was something about the file permissions.
I can post what I made if you want, but like I said, it did crash the server a lot.
Re: /unban Command -
andyF - 01.04.2010
What did you do? Any ideas of what's causing this bug? By the way, I am using fopen for my registration.
Re: /unban Command -
Outbreak - 01.04.2010
Sorry for the late reply, was kinda busy.
This is a very old version of the command i wrote for my gamemode, i now use dcmd, sscanf and for user accounts i use sqlite, which makes unbanning and account editing work perfectly.
Anyway, i couldn't figure out why it was making it crash, the only thing i changed this time was "io_append" because i was using "io_write" before.
Maybe that was causing a problem, i dont know.
http://pastebin.com/X06Jia38
Good luck
Re: /unban Command -
andyF - 01.04.2010
Thanks, I'll test it in game and see what happens.