Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- integer channelListen = 5;
- integer channelDialog = -318766;
- key createQuery;
- key checkQuery;
- string password = "coucou";
- createNewUser(string password, string username, string firstname, string lastname, string birthdate)
- {
- createQuery = llHTTPRequest("https://www.creadev.tk/sl/createUser.php",
- [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"password=" + password +
- "&username=" + username + "&firstname=" + firstname + "&lastname=" + lastname + "&birthdate=" + birthdate);
- }
- checkUsernameExist(string password, string username, string id)
- {
- checkQuery = llHTTPRequest("https://www.creadev.tk/sl/checkUsernameExist.php",
- [HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/x-www-form-urlencoded"],"password=" + password +
- "&username=" + username + "&avatar_key=" + id);
- }
- confirmInformations(key id, string firstname, string lastname, string birthdate)
- {
- 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);
- }
- beginRegistration(string id)
- {
- key identifier = id;
- string username = llGetUsername(id);
- integer listen1 = llListen(channelListen, "", identifier, "");
- integer listen2 = llListen(channelDialog, "", identifier, "");
- llListenControl(listen1, TRUE);
- llListenControl(listen2, TRUE);
- llSay(0, username + ", entrez vos informations s'il vous plait.");
- llSay(0, username + ", la commande est : /5 <prénom RP> <nom RP> <date de naissance RP>");
- }
- default
- {
- touch_start(integer decompte)
- {
- key id = llDetectedKey(0);
- string username = llGetUsername(id);
- checkUsernameExist(password, username, id);
- }
- listen(integer channel, string name, key id, string message)
- {
- string username = llGetUsername(id);
- list array = llParseString2List(message,[" "],["."]);
- string lastname = llList2String(array, 0);
- string firstname = llList2String(array, 1);
- string birthdate = llList2String(array, 2);
- if (channel == channelListen)
- {
- if(llStringLength(lastname) != 0 && llStringLength(firstname) != 0 && llStringLength(birthdate) != 0)
- confirmInformations(id, firstname, lastname, birthdate);
- else
- llSay(0, username + ", l'un des champs remplis est vide ! Veuillez recommencer s'il vous plait.");
- }
- if (channel == channelDialog)
- {
- if(message == "Oui")
- {
- llSay(0, username +", votre personnage RP va pouvoir être crée. Veuillez patienter s'il vous plait, nous faisons le nécessaire.");
- integer listen1 = llListen(channelListen, "", id, "");
- integer listen2 = llListen(channelDialog, "", id, "");
- llListenControl(listen1, FALSE);
- llListenControl(listen2, FALSE);
- createNewUser(password, username, firstname, lastname, birthdate);
- }
- if(message == "Non")
- {
- llSay(0, "Bien, nous allons recommencer. Entrez vos informations.");
- llSay(0, "commande : /5 <prénom RP> <nom RP> <date de naissance RP>");
- }
- }
- }
- http_response(key request_id, integer status, list metadata, string body)
- {
- if (request_id == createQuery)
- {
- llSay(0, body);
- }
- if (request_id == checkQuery)
- {
- if(body == "0")
- {
- llSay(0, "Votre compte existe déjà.");
- }
- else
- {
- beginRegistration((key) body);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement