/unban
#1

sorry im posting again about this,i just wanted how to fix it.
my CMD /unban is not working,i use it for who players get banned but it is saying
"Not In the database"
Код:
CMD:unban(playerid, params[])
{
	LoginCheck(playerid);
	if(User[playerid][accountAdmin] >= 2)
	{
	    new
			string[150],
			Account[24],
			DBResult:Result,
			Query[129],
			fIP[30]
		;
		if(sscanf(params, "s[24]", Account)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unban [account name]");
	    format(Query, 129, "SELECT  FROM `bans` WHERE `username` = '%s'", Account);
		Result = db_query(Database, Query);

		if(db_num_rows(Result))
		{
        	db_get_field_assoc(Result, "ip", fIP, 30);
			if(CheckBan(fIP))
			{
				RemoveBan(fIP);
			}
	        format(Query, 129, "DELETE FROM `bans` WHERE `username` = '%s'", Account);
		    Result = db_query(Database, Query);
	        db_free_result(Result);

			format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by an admin.", Account);
			SendPlayerMessage(COLOR_ORANGE, string);
			format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by %s.", Account, GetName(playerid));
			SendAMessage(COLOR_ORANGE, string);
			format(string, sizeof string, "[UNBANNED] %s has been unbanned by %s.", Account, GetName(playerid));
		    Log("ban.txt", string);
		}
		else
		{
		    db_free_result(Result);
		    SendClientMessage(playerid, -1, "» "red"Player is not in the banned database.");
		    return 1;
		}
	}
	else
	{
	    SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command.");
	}
	return 1;
}
Reply
#2

Quote:

CMD:unban(playerid, params[])
{
LoginCheck(playerid);
if(User[playerid][accountAdmin] >= 2)
{
new
string[150],
Account[24],
DBResult:Result,
Query[129],
fIP[30]
;
if(sscanf(params, "s[24]", Account)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /unban [account name]");
format(Query, 129, "SELECT FROM `bans` WHERE `username` = '%s'", Account);
Result = db_query(Database, Query);

if(db_num_rows(Result))
{
db_get_field_assoc(Result, "ip", fIP, 30);
if(CheckBan(fIP))
{
RemoveBan(fIP);
}
format(Query, 129, "DELETE FROM `bans` WHERE `username` = '%s'", Account);
Result = db_query(Database, Query);
db_free_result(Result);

format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by an admin.", Account);
SendPlayerMessage(COLOR_ORANGE, string);
format(string, sizeof string, "[UNBANNED] "white"%s has been unbanned by %s.", Account, GetName(playerid));
SendAMessage(COLOR_ORANGE, string);
format(string, sizeof string, "[UNBANNED] %s has been unbanned by %s.", Account, GetName(playerid));
Log("ban.txt", string);
}
else
{
db_free_result(!Result);
SendClientMessage(playerid, -1, "» "red"Player is not in the banned database.");
return 1;
}
}
else
{
SendClientMessage(playerid, -1, "» "red"You are not authorized to use this command.");
}
return 1;
}

Try this one.
Reply
#3

pawn Код:
format(Query, 129, "SELECT FROM `bans` WHERE `username` = '%s'", Account);
SELECT what from bans?
pawn Код:
format(Query, 129, "SELECT * FROM `bans` WHERE `username` = '%s'", Account);
Same goes with every other format statement.
Reply
#4

Quote:
Originally Posted by Erno.
Посмотреть сообщение
Try this one.
is this okay?
pawn Код:
C:\Program Files\eclipse\JaKe\gamemodes\blank.pwn(5788) : warning 213: tag mismatch
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


1 Warning.
Quote:
Originally Posted by LivingLikeYouDo
Посмотреть сообщение
pawn Код:
format(Query, 129, "SELECT FROM `bans` WHERE `username` = '%s'", Account);
SELECT what from bans?
pawn Код:
format(Query, 129, "SELECT * FROM `bans` WHERE `username` = '%s'", Account);
Same goes with every other format statement.
i dont know,i just use JaKe's Script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)