Advertisement
Guest User

Untitled

a guest
Apr 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.99 KB | None | 0 0
  1. integer channelListen = 5;
  2. integer channelDialog = -318766;
  3. key createQuery;
  4. key checkQuery;
  5. string password = "coucou";
  6.  
  7. createNewUser(string password, string username, string firstname, string lastname, string birthdate)
  8. {
  9. createQuery = llHTTPRequest("https://www.creadev.tk/sl/createUser.php",
  10. [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"password=" + password +
  11. "&username=" + username + "&firstname=" + firstname + "&lastname=" + lastname + "&birthdate=" + birthdate);
  12. }
  13.  
  14. checkUsernameExist(string password, string username, string id)
  15. {
  16. checkQuery = llHTTPRequest("https://www.creadev.tk/sl/checkUsernameExist.php",
  17. [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"password=" + password +
  18. "&username=" + username + "&avatar_key=" + id);
  19. }
  20.  
  21. confirmInformations(key id, string firstname, string lastname, string birthdate)
  22. {
  23. llDialog(id, "Voici les informations que nous avons retenus :\n\nPrénom RP : \"" +firstname + "\"\nNom RP : \"" + lastname + "\"\nDate de naissance : \"" + birthdate + "\"\n\nConfirmez-vous les informations fournies ?" , [ "Oui", "Non"], channelDialog);
  24. }
  25.  
  26. beginRegistration(string id)
  27. {
  28. key identifier = id;
  29. string username = llGetUsername(id);
  30. integer listen1 = llListen(channelListen, "", identifier, "");
  31. integer listen2 = llListen(channelDialog, "", identifier, "");
  32. llListenControl(listen1, TRUE);
  33. llListenControl(listen2, TRUE);
  34. llSay(0, username + ", entrez vos informations s'il vous plait.");
  35. llSay(0, username + ", la commande est : /5 <prénom RP> <nom RP> <date de naissance RP>");
  36. }
  37.  
  38. default
  39. {
  40. touch_start(integer decompte)
  41. {
  42. key id = llDetectedKey(0);
  43. string username = llGetUsername(id);
  44. checkUsernameExist(password, username, id);
  45. }
  46.  
  47. listen(integer channel, string name, key id, string message)
  48. {
  49. string username = llGetUsername(id);
  50. list array = llParseString2List(message,[" "],["."]);
  51. string lastname = llList2String(array, 0);
  52. string firstname = llList2String(array, 1);
  53. string birthdate = llList2String(array, 2);
  54.  
  55. if (channel == channelListen)
  56. {
  57. if(llStringLength(lastname) != 0 && llStringLength(firstname) != 0 && llStringLength(birthdate) != 0)
  58. confirmInformations(id, firstname, lastname, birthdate);
  59. else
  60. llSay(0, username + ", l'un des champs remplis est vide ! Veuillez recommencer s'il vous plait.");
  61. }
  62. if (channel == channelDialog)
  63. {
  64. if(message == "Oui")
  65. {
  66. llSay(0, username +", votre personnage RP va pouvoir être crée. Veuillez patienter s'il vous plait, nous faisons le nécessaire.");
  67. integer listen1 = llListen(channelListen, "", id, "");
  68. integer listen2 = llListen(channelDialog, "", id, "");
  69. llListenControl(listen1, FALSE);
  70. llListenControl(listen2, FALSE);
  71. createNewUser(password, username, firstname, lastname, birthdate);
  72. }
  73.  
  74. if(message == "Non")
  75. {
  76. llSay(0, "Bien, nous allons recommencer. Entrez vos informations.");
  77. llSay(0, "commande : /5 <prénom RP> <nom RP> <date de naissance RP>");
  78. }
  79. }
  80. }
  81.  
  82. http_response(key request_id, integer status, list metadata, string body)
  83. {
  84. if (request_id == createQuery)
  85. {
  86. llSay(0, body);
  87. }
  88.  
  89. if (request_id == checkQuery)
  90. {
  91. if(body == "0")
  92. {
  93. llSay(0, "Votre compte existe déjà.");
  94. }
  95. else
  96. {
  97. beginRegistration((key) body);
  98. }
  99. }
  100. }
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement