04.10.2013, 00:36
pawn Код:
public Player_inscription(playerid, Register_password[], Register_age, Register_sex, Register_skin)
{
new Requete[500], AdresseIP[18], Nom[MAX_PLAYER_NAME], result[LITTLE_STRING], newId;
new sqlpassword[32];
format(Requete, sizeof(Requete), "SELECT COUNT(*) FROM comptes");
mysql_query(Requete);
mysql_store_result();
mysql_fetch_row(result);
newId = strval(result) + 1;
mysql_free_result();
GetPlayerIp(playerid, AdresseIP, sizeof(AdresseIP));
GetPlayerName(playerid, Nom, sizeof(Nom));
mysql_real_escape_string(Register_password, sqlpassword);
format(Requete, sizeof(Requete), "INSERT INTO comptes SET `Name`='%s', `Password`='%s', `Ip`='%s', `Age`='%d', `Sex`='%d', `Skin`='%d', `Nouveau`='1'", Nom, sqlpassword, AdresseIP, Register_age, Register_sex, Register_skin);
mysql_query(Requete);
Player_infos[playerid][p_Sql_Id] = newId;
Player_inscription_etape[playerid] = 6;
Player_inscription_skin[playerid] = 0;
Player_inscription_sex[playerid] = 0;
Player_inscription_age[playerid] = 0;
Player_spawn(playerid);
return 1;
}
pawn Код:
if(dialogid == PLAYER_DIALOG_INSCRIPTION)
{
if(!response)
{
Player_erreur_dialog(playerid, "Йtape d'inscription.", "Vous venez d'annuler l'йtape d'inscription sur XX.");
SetTimerEx("Player_kick", 1000, 0, "d", playerid);
return 1;
}
if(Player_inscription_etape[playerid] == 1)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de votre mot de passe.", "Entrez le mot de passe souhaitй:", "Continuer", "");
Player_inscription_etape[playerid] = 2;
}
else if(Player_inscription_etape[playerid] == 2)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de votre mot de passe.", "Entrez le mot de passe souhaitй:", "Continuer", "");
return 1;
}
if(strlen(inputtext) < 3)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de votre mot de passe.", "Votre mot de passe doit contenir au minimum 3 caractиres.", "Continuer", "");
return 1;
}
if(strlen(inputtext) > 27)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de votre mot de passe.", "Votre mot de passe peut disposer uniquement de 27 caractиres au maximum.", "Continuer", "");
return 1;
}
strmid(Player_inscription_password[playerid], inputtext, 0, strlen(inputtext), 255);
Player_inscription_etape[playerid] = 3;
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "Entrez l'вge de votre personnage:", "Continuer", "");
}
else if(Player_inscription_etape[playerid] == 3)
{
if(strlen(inputtext) == 0)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "Entrez l'вge de votre personnage:", "Continuer", "");
return 1;
}
if(strval(inputtext) < 13)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "L'вge de votre personnage doit кtre de 13 ans minimum:", "Continuer", "");
return 1;
}
if(strval(inputtext) > 80)
{
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_INPUT, "Choix de l'вge du personnage.", "L'вge de votre personnage doit кtre de 80 ans au maximum:", "Continuer", "");
return 1;
}
Player_inscription_age[playerid] = strval(inputtext);
ShowPlayerDialog(playerid, PLAYER_DIALOG_INSCRIPTION, DIALOG_STYLE_LIST, "Choix du sexe du personnage.", "Homme.\nFemme.", "Continuer", "");
Player_inscription_etape[playerid] = 5;
}
else if(Player_inscription_etape[playerid] == 5)
{
Player_inscription_sex[playerid] = listitem+1;
new rand = random(299);
SetPlayerSkin(playerid, rand);
Player_inscription_skin[playerid] = rand;
Player_inscription(playerid, Player_inscription_password[playerid], Player_inscription_age[playerid], Player_inscription_sex[playerid], Player_inscription_skin[playerid]);
}
}