Advertisement
AlexRap

Untitled

Nov 16th, 2018
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.69 KB | None | 0 0
  1. comanda:
  2. YCMD:staff(playerid, params[], help) {
  3. if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_LIGHTGREEN3, AdminOnly);
  4. ShowPlayerDialog(playerid, DIALOG_STAFF, DIALOG_STYLE_LIST, "Staff", "Admins\nHelpers", "Ok", "Close");
  5. return 1;
  6. }
  7. pui la ondialogresponse:
  8. if(dialogid == DIALOG_STAFF) {
  9. if(!response) return 1;
  10. new szQuery[1024], szResult[1024], szDialog[1024], szDialog2[4000], Cache: result;
  11. new szName[180], szAdmin, szLastOn[180], x, y, szTitle[180], userID;
  12. switch(listitem) {
  13. case 0:
  14. {
  15. format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Admin`>'0' ORDER BY `users`.`Admin` ASC LIMIT 50");
  16. result = mysql_query(SQL, szQuery);
  17. strcat(szDialog2, "Name\tStatus\n");
  18. for(new i, j = cache_get_row_count (); i < j; i++)
  19. {
  20. cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
  21. cache_get_field_content(i, "Admin", szResult); szAdmin = strval(szResult);
  22. cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);
  23. userID = GetPlayerID( szName );
  24. if(userID != INVALID_PLAYER_ID) format(szLastOn, 256, "Online (%d)", userID);
  25.  
  26. x++;
  27. format(szDialog, sizeof(szDialog), "(%d) %s\t%s\n", szAdmin, szName, szLastOn);
  28. strcat(szDialog2, szDialog);
  29. }
  30. cache_delete(result);
  31. format(szTitle, sizeof(szTitle), "Admins (%d/%d)", GetStaffOnline(0), x);
  32. }
  33. case 1:
  34. {
  35. format(szQuery, sizeof(szQuery), "SELECT * FROM `users` WHERE `Helper`>'0' ORDER BY `users`.`Helper` ASC LIMIT 50");
  36. result = mysql_query(SQL, szQuery);
  37. strcat(szDialog2, "Name\tStatus\n");
  38. for(new i, j = cache_get_row_count (); i < j; i++)
  39. {
  40. cache_get_field_content(i, "name", szResult); format(szName, 256, szResult);
  41. cache_get_field_content(i, "Helper", szResult); szAdmin = strval(szResult);
  42. cache_get_field_content(i, "lastOn", szResult); format(szLastOn, 256, "Offline (%s)", szResult);
  43.  
  44. userID = GetPlayerID( szName );
  45. if(userID != INVALID_PLAYER_ID) format(szLastOn, 256, "Online (%d)", userID);
  46. y++;
  47. format(szDialog, sizeof(szDialog), "(%d) %s\t%s\n", szAdmin, szName, szLastOn);
  48. strcat(szDialog2, szDialog);
  49. }
  50. cache_delete(result);
  51. format(szTitle, sizeof(szTitle), "Helpers (%d/%d)", GetStaffOnline(1), y);
  52. }
  53. }
  54. ShowPlayerDialog(playerid, DIALOG_STAFF2, DIALOG_STYLE_TABLIST_HEADERS, szTitle, szDialog2, "Ok", "Back");
  55. }
  56. if(dialogid == DIALOG_STAFF2) {
  57. if(!response) return ShowPlayerDialog(playerid, DIALOG_STAFF, DIALOG_STYLE_LIST, "Staff", "Admins\nHelpers", "Ok", "Close");
  58. }
  59. #define DIALOG_STAFF 6969
  60. #define DIALOG_STAFF2 6970
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement