Is Field Exists - SQLite
#2

pawn Код:
new DB: Result, query[128], str[128];
format(query, sizeof(query), "SELECT * FROM players WHERE username = '%s' LIMIT 0, 1", PlayerInfo[playerid][Name]); // You need to get the player name On Player Connect & save it in PlayerInfo[playerid][Name]..
Result = db_query(Database, query);
if (db_num_rows(Result)) // If something came up..
{
       db_get_field_assoc(Result, "admin", query, 3); // It will get the data in the field 'admin'..
       PlayerInfo[playerid][pAdmin] = strval(query); // Converting it to integer..
       format(str, sizeof(str), "Your admin level is: %d", PlayerInfo[playerid][pAdmin]);
       SendClientMessage(playerid, -1, str); // It will show the player his admin level
}
db_free_result(Result);
This is just an example. I'm not sure that this is the right or there is any faster way to get data...
(+ I'm not a professional.)
Reply


Messages In This Thread
Is Field Exists - SQLite - by Quis - 19.01.2014, 07:33
Re: Is Field Exists - SQLite - by SyntaxQ - 19.01.2014, 08:16

Forum Jump:


Users browsing this thread: 1 Guest(s)