SA-MP Forums Archive
Online - 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)
+--- Thread: Online (/showthread.php?tid=505737)



Online - Mriss - 10.04.2014

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


Re: Online - Flake. - 10.04.2014

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