Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Inside admin system (the functions are bellow):
- static load_id;
- hook OnGameModeInit()
- {
- load_id = AddLoginData("SELECT admin FROM admins WHERE id=%i", "i");
- return 1;
- }
- hook OnPlayerLoad()
- {
- cache_set_result(load_id);
- cache_get_value_name_int(0, "admin", AdminLevel[playerid]);
- if(AdminLevel[playerid] > 0)
- Iter_Add(admins, playerid);
- return 1;
- }
- //Functions used:
- static formatted_QUERY[4096];
- static Functions[500]
- AddLoginData(q[], func[])
- {
- strcat(formatted_QUERY, q);
- strcat(Functions, func);
- return 1;
- }
- hook OnUserFound(playerid)
- {
- new values[500];
- for(new i = 0; Functions[i]; i++)
- {
- switch(Function[i])
- {
- case 'i': values[i] = GetPlayerId(playerid);
- case 't': values[i] = gettime();
- default: printf("forgot to add some functions? (%c)", Function[i]);
- }
- }
- new q[4096];
- format(q, sizeof(q), formatted_QUERY, ?? ) // Pass values here
- mysql_pquery(db, q, "_load_User_data", "ii", playerid, PlayerChecker[playerid]);
- return 1;
- }
- forward _load_User_data(playerid, checker);
- public _load_User_data(playerid, checker)
- {
- // check for race condition here
- CallLocalFunction("OnPlayerLoad", "i", playerid);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement