Advertisement
Guest User

Untitled

a guest
Oct 26th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.58 KB | None | 0 0
  1.  
  2. forward LoadJobs();
  3. public LoadJobs()
  4. {
  5. new
  6. id,
  7. Cache:result,
  8. count_nb;
  9.  
  10. result = mysql_tquery(dbhandle, "SELECT * FROM `server_jobs` ORDER BY id");
  11. if(cache_num_rows())
  12. {
  13. for(new i, count_nb = cache_get_row_count(); i < count_nb; i++)
  14. {
  15.  
  16. id = cache_get_field_content_int(i, "id");
  17.  
  18. if(i >= sizeof(Job_infos)) continue;
  19.  
  20. //Job_infos[i][j_ID] = cache_get_field_content_int(i, "id");
  21.  
  22. Job_infos[i][j_Type] = cache_get_field_content_int(i, "type");
  23.  
  24. new nomjob[64];
  25. cache_get_field_content(i, "name", nomjob);
  26. format(Job_infos[i][j_Name], 64, "%s", nomjob);
  27.  
  28. count_nb++;
  29.  
  30. }
  31. }
  32. cache_delete(result);
  33. printf("Chargement de %d jobs.", count_nb);
  34. return 1;
  35. }
  36.  
  37.  
  38.  
  39.  
  40. stock SQLtoJOB(id)
  41. {
  42. if(id <= 0)
  43. {
  44. return -1;
  45. }
  46. for(new i = 0; i < sizeof(Job_infos); i++)
  47. {
  48. if(id == Job_infos[i][j_ID]) return i;
  49. }
  50. return -1;
  51. }
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. CMD:joblist(playerid, params[])
  64. {
  65. new string[600];
  66.  
  67. SendClientMessage(playerid, COLOR_TBLUE, "Liste des jobs du serveur:");
  68. SendClientMessage(playerid, COLOR_TBLUE, "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯");
  69.  
  70.  
  71. for (new i = 0; i != MAX_JOBS; i ++)
  72. //for(new i = 0; i < sizeof(Job_infos); i++)
  73. {
  74. if(Job_infos[i][j_ID] > 0)
  75. {
  76.  
  77. format(string, sizeof(string), "ID: %d | %s | TYPE: %d", Job_infos[i][j_ID], Job_infos[i][j_Name], Job_infos[i][j_Type]);
  78. SendClientMessage(playerid, -1, string);
  79.  
  80. }
  81. }
  82.  
  83. return 1;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement