Guest User

Untitled

a guest
Jan 8th, 2018
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. // [!] Here, after login, we see a dialog with the all characters of user
  2. //
  3. //______________________________________________________________________
  4.  
  5.  
  6.  
  7. /*---------------------------------------------------------------------------------*/
  8. forward ShowCharacters(playerid);
  9. public ShowCharacters(playerid)
  10. {
  11. new query[256];
  12.  
  13. format(query, sizeof(query), "SELECT * FROM `server_characters` WHERE id_account=%d", AccountInfo[playerid][Account_ID]);
  14. mysql_tquery(dbhandle, query, "ChoixPersonnage", "i", playerid);
  15.  
  16. return 1;
  17. }
  18.  
  19.  
  20. forward ChoixPersonnage(playerid);
  21. public ChoixPersonnage(playerid)
  22. {
  23. new rows,
  24. fields,
  25. // string[256],
  26. //count,
  27. name[64];
  28.  
  29.  
  30. cache_get_data(rows, fields);
  31.  
  32. if(rows)
  33. {
  34.  
  35. new content[500];
  36. for(new i; i < rows; i++)
  37. {
  38. cache_get_field_content(i, "username", name);
  39. //format(string, sizeof(string),"Personnage: {FFFFFF}%s", name);
  40. //SendClientMessage(playerid, -1, string);
  41.  
  42. format(content, sizeof(content), "%s%s\n", content, name);
  43. ShowPlayerDialog(playerid, DIALOG_CHOIX_PERSO, DIALOG_STYLE_LIST, "Choix de votre personnage", content, "Valider", "Quitter");
  44. }
  45.  
  46. }
  47.  
  48.  
  49. else
  50. {
  51. SendClientMessage(playerid, COLOR_ADMIN, "Erreur: Votre personnage n'est pas activé !");
  52. }
  53.  
  54.  
  55. return 1;
  56. }
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63. // [!] Now, I press on an character of my account
  64. //
  65. //______________________________________________________________________
  66.  
  67.  
  68.  
  69. case DIALOG_CHOIX_PERSO:
  70. {
  71.  
  72. new query[600];
  73.  
  74. format(query, sizeof(query), "SELECT * FROM `server_characters` WHERE id_account=%d", AccountInfo[playerid][Account_ID]);
  75. mysql_tquery(dbhandle, query, "Load_Character", "i", playerid);
  76.  
  77. }
  78.  
  79.  
  80.  
  81.  
  82.  
  83.  
  84. /*---------------------------------------------------------------------------------*/
  85. forward Load_Character(playerid);
  86. public Load_Character(playerid)
  87. {
  88. new rows,
  89. fields,
  90. string[600],
  91. string2[600];
  92.  
  93. cache_get_data(rows, fields);
  94.  
  95. if(rows)
  96. {
  97. new cid = cache_get_field_content_int(0, "id");
  98.  
  99. new skinid = cache_get_field_content_int(0, "skin_player");
  100.  
  101. new statutcompte = cache_get_field_content_int(0, "statut_character");
  102.  
  103. new name[64];
  104. cache_get_field_content(0, "username", name);
  105.  
  106. //SetPlayerName(playerid, PlayerInfo[playerid][p_Username]);
  107.  
  108. format(string, sizeof(string), "Votre personnage (n°%d) avec le pseudo %s portant le skin %d | Statut du personnage: %d", cid, name, skinid, statutcompte);
  109. SendClientMessage(playerid, COLOR_ADMIN, string);
  110. SendClientMessage(playerid, COLOR_ADMIN, "____________________________________");
  111.  
  112.  
  113. format(string2, sizeof(string2), "Voici un aperçu des stats de votre personnage choisi:\n\nID: %d\nPersonnage: %s\nSkin: %d\nStatut du personnage: %d", cid, name, skinid, statutcompte);
  114. ShowPlayerDialog(playerid, DIALOG_INFO_PERSO, DIALOG_STYLE_MSGBOX, "Information concernant votre personnage", string2, "SPAWN", "");
  115.  
  116. }
  117.  
  118. return 1;
  119. }
Advertisement
Add Comment
Please, Sign In to add comment