Online
#1

So I want to make it when someone logs in it sets On‌line = 1 In MySQL

Okay so this is what is on my OnPlayerCOnnect

pawn Код:
new query[250];
    mysql_format(MysqlCon, query, sizeof(query), "UPDATE `players` SET `Online`=1 WHERE `ID`=%d AND `user`='%e'",
    pInfo[playerid][pID],
    PlayerName(playerid));
    mysql_tquery(MysqlCon, query, "", "");
And OnPlayerDisconnect
pawn Код:
new query[250];
    mysql_format(MysqlCon, query, sizeof(query), "UPDATE `players` SET `Online`=0 WHERE `ID`=%d AND `user`='%e'",
    pInfo[playerid][pID],
    PlayerName(playerid));
    mysql_tquery(MysqlCon, query, "", "");

but when they connect, it doesnt seem to actuallly set them Online in MySQL.
Please Help
Reply
#2

Theres really no need to set online to the player and the id, try this.

pawn Код:
new query[250];
    mysql_format(MysqlCon, query, sizeof(query), "UPDATE `players` SET `Online`=1 WHERE `user`=%s",
    PlayerName(playerid));
    mysql_tquery(MysqlCon, query, "", "");
//You can also try print(query); for more debuging if this doesn't work, also check your mysql.log
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)