MySQL Help!!
#1

The unban command itself works fine, it gets deleted from the database.

However, the reason, date + IP does not display (It's saved properly in the database, as i see it in PHPMyAdmin fine.)

What have i done wrong?

pawn Код:
new checkquery2[128];
                format(checkquery2, sizeof(checkquery2), "SELECT `Username` FROM `bans` WHERE `Username` = '%s'", tmp);
                mysql_reconnect();
                mysql_query(checkquery2);
                mysql_store_result();
                if(mysql_num_rows() > 0) //BANNED
                {
                    new line[500];
                    if(mysql_fetch_row(line)) //Fetches the line
                    {
                        new data[5][128]; //The data strings
                        sscanf(line, "p<|>sssss", data[0], data[1], data[2], data[3], data[4]); //Splits the line with sscanf
                        format(string, sizeof(string), "You have unbanned the player {1B8AE4}%s(%s)", tmp, data[3]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string,sizeof(string), "[Ban Details] Banned by {1B8AE4}%s {FFFFFF}• {1B8AE4}[Reason: %s] {FFFFFF}at {1B8AE4}[%s]", data[2], data[1], data[4]);
                        SendClientMessage(playerid, COLOR_WHITE, string);
                        format(string,sizeof(string), "Admin %s has unbanned %s [Banned by: %s, reason: %s]", PlayerName(playerid), tmp, data[2], data[4]);
                        ABroadCast(COLOR_ADMIN,string,1);
                        new deletequery2[128];
                        mysql_reconnect();
                        format(deletequery2, sizeof(deletequery2), "DELETE FROM bans WHERE Username = '%s'", tmp);
                        mysql_query(deletequery2);
                        mysql_free_result();
                        return 1;
                    }
                    mysql_free_result();
Reply
#2

Please help!

+rep will be given!
Reply
#3

I had the same problem too. Anybody got a solution?
Reply
#4

Why is no-one helping us, LoF ??

Aww!!
Reply
#5

Not sure GamingTurf, people must be busy or people don't know the answer.

Reply
#6

" format(checkquery2, sizeof(checkquery2), "SELECT `Username` FROM `bans` WHERE `Username` = '%s'", tmp);"

You aren't loading the ban information.
Reply
#7

What do you use Data[4] for ?
For bantime, or banreason?
Reply
#8

Data[4] is for the Date.


And how can i load the ban information? I tried with that sscanf line.
Reply
#9

Well, here are some lines from my script to login. You might can copy some stuff from it.

Код:
	AvoidOOSync();
        new id, playername[MAX_PLAYER_NAME],pass[50], money, score, banned, elite, kills, deaths, jailed,          jailtimeleft, rank, muted, ip[20], registerdate[10], lastlogged[10], planesteals, drugsteals;
        mysql_format(MySqlConnection, query, "SELECT * FROM users WHERE Playername='%e'",GetName(playerid));
	mysql_query(query);
	mysql_store_result();
	mysql_fetch_row_format(result,"|");
	sscanf(result,"p<|>is[50]iiiiiiiiiis[50]s[20]s[10]s[10]ii", id, playername, money, score, banned, elite, kills, deaths,  jailed, jailtimeleft, rank, muted, pass, ip, registerdate, lastlogged, planesteals, drugsteals);
	AvoidOOSync();
	new day;
	new month;
	new year;
	getdate(year, month, day);
	mysql_format(MySqlConnection,query,"UPDATE users SET LastLogged='%d/%d/%d', IP='%s' WHERE Playername='%e'",day,month,year,GetPVarStr(playerid,"IP"),GetName(playerid));
	mysql_query(query);
Reply
#10

Can anyone help?

Myself and nodroz tried, could not resolve this problem.

Anyone else see what is wrong with this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)