Help please
#1

i have problem in my script,I want to make a register system like this picture:

Quote:

In this dialog you create new password, and i click "Daftar" to create new account

next,it will display a dialog Sex / Gender

Quote:

in this dialog you choose your character sex, and i click "OK" to next

next,it will display a dialog Age Character

Quote:

In this dialog you can choose your character age

so I've made it 5 times but always failed, can you help me?
Reply
#2

Try This,

Код:
#define Register 1 
#define Email 2 
#define Sex 3 
#define Age 4 
#define Orgin 5 
#define Mood 6 
#define Login 7 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
  if(dialogid == Register) 
  { 
    if(!response) return Kick(playerid); 
    if(response) 
    { 
      new string[512],ip[16],str[250],hour,minute,second,day,month,year; 
      gettime(hour,minute,second); 
      getdate(year,month,day); 
      GetPlayerIp(playerid, ip, sizeof(ip)); 
      format(str, sizeof str,"[%d:%d:%d][%d:%d:%d]", day, month, year, hour, minute, second); 
      new INI:File = INI_Open(UserPath(playerid)); 
      INI_SetTag(File,"Player-Data"); 
      //--[Basic Info] 
      INI_WriteString(File,"UserName",GetName(playerid)); 
      INI_WriteString(File,"IP",ip); 
      INI_WriteString(File,"Email","Unset"); 
      INI_WriteString(File,"Registration Date",str); 
      INI_WriteInt(File,"Password",udb_hash(inputtext)); 
      INI_WriteString(File,"LastLogin","Unset"); 
      INI_WriteInt(File,"Age",0); 
      INI_WriteString(File,"Orgin","Unset"); 
      INI_WriteInt(File,"SexShown",0); 
      INI_WriteInt(File,"Sex",6); 
      INI_WriteInt(File,"ChangeSexOnly",0); 
      INI_WriteInt(File,"LogOnAttempt",0); 
      INI_WriteInt(File,"Seconds",PlayerInfo[playerid][pSec]); 
      INI_WriteInt(File,"Minutes",PlayerInfo[playerid][pMin]); 
      INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]); 
      INI_WriteInt(File,"Days",PlayerInfo[playerid][pDay]); 
      INI_WriteInt(File,"Years",PlayerInfo[playerid][pYears]); 
      INI_WriteString(File,"Mood"," "); 
      INI_WriteInt(File,"MoodSpawn",0); 
      //--[Player Commands] 
      INI_WriteInt(File,"ChangeView",PlayerInfo[playerid][pChangeView]); 
      INI_WriteInt(File,"ChangeView2",PlayerInfo[playerid][pChangeView2]); 
      INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]); 
      INI_WriteInt(File,"Duty",PlayerInfo[playerid][pDuty]); 
      INI_WriteInt(File,"Frozen",PlayerInfo[playerid][pFrozen]); 
      INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMute]); 
      INI_WriteInt(File,"Spectating",PlayerInfo[playerid][pSpectating]); 
      INI_WriteInt(File,"Warning",PlayerInfo[playerid][pWarning]); 
      //--[Player Shopping Items] 
      INI_WriteInt(File,"CD-Player",PlayerInfo[playerid][pCDMP3Player]); 
      INI_WriteInt(File,"FishingToolBox",PlayerInfo[playerid][pFishTool]); 
      INI_WriteInt(File,"Watch",PlayerInfo[playerid][pWatch]); 
      INI_WriteInt(File,"Beers",PlayerInfo[playerid][pBeers]); 
      INI_WriteInt(File,"Cigs",PlayerInfo[playerid][pCigarettes]); 
      INI_WriteInt(File,"Lighter",PlayerInfo[playerid][pLighter]); 
      INI_WriteInt(File,"Helmet",PlayerInfo[playerid][pHelmet]); 
      //--[Player Varables] 
      INI_WriteInt(File,"Admin",0); 
      INI_WriteInt(File,"VIP",0); 
      INI_WriteInt(File,"Money", WelcomeGift); 
      INI_WriteInt(File,"BankAccount",0); 
      INI_WriteInt(File,"Score",0); 
      INI_WriteInt(File,"Kills",0); 
      INI_WriteInt(File,"Deaths",0); 
      INI_WriteInt(File,"WantedLevel",0); 
      INI_WriteInt(File,"STD's",0); 
      INI_WriteInt(File,"Smoked",0); 
      INI_WriteInt(File,"Cancer",0); 
      INI_WriteInt(File,"Health",0); 
      INI_WriteInt(File,"Armour",0); 
      //--[Pos] 
      INI_WriteFloat(File,"X",1960.9506); 
      INI_WriteFloat(File,"Y",1343.3920); 
      INI_WriteFloat(File,"Z",15.3746); 
      INI_WriteFloat(File,"Angle",89.1425); 
      INI_WriteInt(File,"Interior",0); 
      INI_WriteInt(File,"VirtualWorld",0); 
      INI_Close(File); 
      ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery","OK","Cancel"); 
      format(string, 512, COLOR_YELLOW"<<Info>>"COLOR_WHITE" Name:"COLOR_ORANGE" %s"COLOR_WHITE" Password:"COLOR_ORANGE" %s"COLOR_WHITE" Has Been"COLOR_RED" Successfully"COLOR_WHITE" Created !!", GetName(playerid), inputtext); 
      SendClientMessage(playerid, -1, string); 
      GivePlayerMoney(playerid,WelcomeGift); 
      format(string, 512, COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Have Been Awarded A Welcome Gift Of"COLOR_GREEN" $2000"COLOR_WHITE" !!"); 
      SendClientMessage(playerid,-1, string); 
    } 
    return 1; 
  } 
  if(dialogid == Email) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery!\n"COLOR_RED"Please Enter Email To Continue!","OK","Cancel"); 
    if(response) 
    { 
      if(strfind(inputtext,"@",true)!= -1 && strfind(inputtext,".",true)!= -1) 
      { 
        format(PlayerInfo[playerid][pEmail], 255, "%s", inputtext); 
        new INI:File = INI_Open(UserPath(playerid)); 
        INI_SetTag(File,"Player-Data"); 
        INI_WriteString(File,"Email",(inputtext)); 
        INI_Close(File); 
        GameTextForPlayer(playerid, "~w~Email ~g~Valid",1000,6); 
        ShowPlayerDialog(playerid,Sex,DIALOG_STYLE_LIST,"Please Select Your Gender To Continue","Male\nFemale","Ok","Cancel"); 
        return 1; 
      } 
      else 
      { 
        ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery!\n"COLOR_RED"Invalid Email!","OK","Cancel"); 
        GameTextForPlayer(playerid, "~w~Email ~r~Invalid",1000,6); 
      } 
    } 
  } 
  if(dialogid == Sex) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Sex,DIALOG_STYLE_LIST,"Please Select Your Gender To Continue","Male\nFemale","Ok","Cancel"); 
    if(response) 
    { 
      switch(listitem) 
      { 
         case 0: 
         { 
           if(PlayerInfo[playerid][pChangeSexOnly] == 0) 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",1); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 1; 
             ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"---------Age--------","Please Enter Your Age To Continue","Ok","Cancel"); 
           } 
           else 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",1); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 1; 
             PlayerInfo[playerid][pChangeSexOnly] = 0; 
           } 
           return 1; 
         } 
         case 1: 
         { 
           if(PlayerInfo[playerid][pChangeSexOnly] == 0) 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",0); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 0; 
             ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"------Age------","Please Enter Your Age To Continue","Ok","Cancel"); 
           } 
           else 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",0); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 0; 
             PlayerInfo[playerid][pChangeSexOnly] = 0; 
           } 
         } 
      } 
    } 
  } 
  if(dialogid == Age) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"--------Age--------","Please Enter Your Age To Continue","Ok","Cancel"); 
    if(response) 
    { 
      new INI:File = INI_Open(UserPath(playerid)); 
      INI_SetTag(File,"Player-Data"); 
      INI_WriteString(File,"Age",(inputtext)); 
      INI_Close(File); 
      ShowPlayerDialog(playerid,Orgin,DIALOG_STYLE_LIST,"--------Location--------","UK\nUSA","Ok","Cancel"); 
    } 
  } 
  if(dialogid == Orgin) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Orgin,DIALOG_STYLE_LIST,"--------Location--------","UK\nUSA","Ok","Cancel"); 
    if(response) 
    { 
      switch(listitem) 
      { 
         case 0: 
         { 
           format(PlayerInfo[playerid][pOrgin], 255, "%s", "UK"); 
           new INI:File = INI_Open(UserPath(playerid)); 
           INI_SetTag(File,"Player-Data"); 
           INI_WriteString(File,"Orgin","UK"); 
           INI_Close(File); 
            
         } 
         case 1: 
         { 
           format(PlayerInfo[playerid][pOrgin], 255, "%s", "USA"); 
           new INI:File = INI_Open(UserPath(playerid)); 
           INI_SetTag(File,"Player-Data"); 
           INI_WriteString(File,"Orgin","USA"); 
           INI_Close(File); 
         } 
      } 
    } 
  } 
  if(dialogid == Login) 
  { 
    if(!response) return Kick(playerid); 
    if(response) 
    { 
      if(udb_hash(inputtext) != PlayerInfo[playerid][pPass]) 
      { 
        if(PlayerInfo[playerid][pLogOnAttempt] == 3) 
        { 
          Kick(playerid); 
          PlayerInfo[playerid][pLogOnAttempt] = 0; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 2) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"1 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 3; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 1) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"2 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 2; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 0) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"3 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 1; 
        } 
      } 
      else 
      { 
        INI_ParseFile(UserPath(playerid),"LoadUserAccounts", .bExtra = true, .extra = playerid); 
        GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); 
        SetPlayerPos(playerid,PlayerInfo[playerid][X],PlayerInfo[playerid][Y],PlayerInfo[playerid][Z]); 
        SetPlayerFacingAngle(playerid,PlayerInfo[playerid][Angle]); 
        SetPlayerInterior(playerid,PlayerInfo[playerid][Interior]); 
        SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][VirtualWorld]); 
        SendClientMessage(playerid,-1,""COLOR_ORANGE"Welcome Back!"COLOR_WHITE" You Have Been"COLOR_RED" Successfully"COLOR_WHITE" Logged In !!"); 
        new string[128]; 
        format(string, sizeof(string),COLOR_YELLOW"<<Player>>"COLOR_ORANGE" %s"COLOR_WHITE" Has Joined The Server !!", GetName(playerid)); 
        SendClientMessageToAll(-1, string); 
      } 
      return 1; 
    } 
} 
return 1; 
}
If I Help Rep+
Reply
#3

Quote:
Originally Posted by Ayyash
Посмотреть сообщение
Try This,

Код:
#define Register 1 
#define Email 2 
#define Sex 3 
#define Age 4 
#define Orgin 5 
#define Mood 6 
#define Login 7 
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) 
{ 
  if(dialogid == Register) 
  { 
    if(!response) return Kick(playerid); 
    if(response) 
    { 
      new string[512],ip[16],str[250],hour,minute,second,day,month,year; 
      gettime(hour,minute,second); 
      getdate(year,month,day); 
      GetPlayerIp(playerid, ip, sizeof(ip)); 
      format(str, sizeof str,"[%d:%d:%d][%d:%d:%d]", day, month, year, hour, minute, second); 
      new INI:File = INI_Open(UserPath(playerid)); 
      INI_SetTag(File,"Player-Data"); 
      //--[Basic Info] 
      INI_WriteString(File,"UserName",GetName(playerid)); 
      INI_WriteString(File,"IP",ip); 
      INI_WriteString(File,"Email","Unset"); 
      INI_WriteString(File,"Registration Date",str); 
      INI_WriteInt(File,"Password",udb_hash(inputtext)); 
      INI_WriteString(File,"LastLogin","Unset"); 
      INI_WriteInt(File,"Age",0); 
      INI_WriteString(File,"Orgin","Unset"); 
      INI_WriteInt(File,"SexShown",0); 
      INI_WriteInt(File,"Sex",6); 
      INI_WriteInt(File,"ChangeSexOnly",0); 
      INI_WriteInt(File,"LogOnAttempt",0); 
      INI_WriteInt(File,"Seconds",PlayerInfo[playerid][pSec]); 
      INI_WriteInt(File,"Minutes",PlayerInfo[playerid][pMin]); 
      INI_WriteInt(File,"Hours",PlayerInfo[playerid][pHours]); 
      INI_WriteInt(File,"Days",PlayerInfo[playerid][pDay]); 
      INI_WriteInt(File,"Years",PlayerInfo[playerid][pYears]); 
      INI_WriteString(File,"Mood"," "); 
      INI_WriteInt(File,"MoodSpawn",0); 
      //--[Player Commands] 
      INI_WriteInt(File,"ChangeView",PlayerInfo[playerid][pChangeView]); 
      INI_WriteInt(File,"ChangeView2",PlayerInfo[playerid][pChangeView2]); 
      INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]); 
      INI_WriteInt(File,"Duty",PlayerInfo[playerid][pDuty]); 
      INI_WriteInt(File,"Frozen",PlayerInfo[playerid][pFrozen]); 
      INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMute]); 
      INI_WriteInt(File,"Spectating",PlayerInfo[playerid][pSpectating]); 
      INI_WriteInt(File,"Warning",PlayerInfo[playerid][pWarning]); 
      //--[Player Shopping Items] 
      INI_WriteInt(File,"CD-Player",PlayerInfo[playerid][pCDMP3Player]); 
      INI_WriteInt(File,"FishingToolBox",PlayerInfo[playerid][pFishTool]); 
      INI_WriteInt(File,"Watch",PlayerInfo[playerid][pWatch]); 
      INI_WriteInt(File,"Beers",PlayerInfo[playerid][pBeers]); 
      INI_WriteInt(File,"Cigs",PlayerInfo[playerid][pCigarettes]); 
      INI_WriteInt(File,"Lighter",PlayerInfo[playerid][pLighter]); 
      INI_WriteInt(File,"Helmet",PlayerInfo[playerid][pHelmet]); 
      //--[Player Varables] 
      INI_WriteInt(File,"Admin",0); 
      INI_WriteInt(File,"VIP",0); 
      INI_WriteInt(File,"Money", WelcomeGift); 
      INI_WriteInt(File,"BankAccount",0); 
      INI_WriteInt(File,"Score",0); 
      INI_WriteInt(File,"Kills",0); 
      INI_WriteInt(File,"Deaths",0); 
      INI_WriteInt(File,"WantedLevel",0); 
      INI_WriteInt(File,"STD's",0); 
      INI_WriteInt(File,"Smoked",0); 
      INI_WriteInt(File,"Cancer",0); 
      INI_WriteInt(File,"Health",0); 
      INI_WriteInt(File,"Armour",0); 
      //--[Pos] 
      INI_WriteFloat(File,"X",1960.9506); 
      INI_WriteFloat(File,"Y",1343.3920); 
      INI_WriteFloat(File,"Z",15.3746); 
      INI_WriteFloat(File,"Angle",89.1425); 
      INI_WriteInt(File,"Interior",0); 
      INI_WriteInt(File,"VirtualWorld",0); 
      INI_Close(File); 
      ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery","OK","Cancel"); 
      format(string, 512, COLOR_YELLOW"<<Info>>"COLOR_WHITE" Name:"COLOR_ORANGE" %s"COLOR_WHITE" Password:"COLOR_ORANGE" %s"COLOR_WHITE" Has Been"COLOR_RED" Successfully"COLOR_WHITE" Created !!", GetName(playerid), inputtext); 
      SendClientMessage(playerid, -1, string); 
      GivePlayerMoney(playerid,WelcomeGift); 
      format(string, 512, COLOR_YELLOW"<<Player Info>>"COLOR_WHITE" You Have Been Awarded A Welcome Gift Of"COLOR_GREEN" $2000"COLOR_WHITE" !!"); 
      SendClientMessage(playerid,-1, string); 
    } 
    return 1; 
  } 
  if(dialogid == Email) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery!\n"COLOR_RED"Please Enter Email To Continue!","OK","Cancel"); 
    if(response) 
    { 
      if(strfind(inputtext,"@",true)!= -1 && strfind(inputtext,".",true)!= -1) 
      { 
        format(PlayerInfo[playerid][pEmail], 255, "%s", inputtext); 
        new INI:File = INI_Open(UserPath(playerid)); 
        INI_SetTag(File,"Player-Data"); 
        INI_WriteString(File,"Email",(inputtext)); 
        INI_Close(File); 
        GameTextForPlayer(playerid, "~w~Email ~g~Valid",1000,6); 
        ShowPlayerDialog(playerid,Sex,DIALOG_STYLE_LIST,"Please Select Your Gender To Continue","Male\nFemale","Ok","Cancel"); 
        return 1; 
      } 
      else 
      { 
        ShowPlayerDialog(playerid,Email,DIALOG_STYLE_INPUT,"Email Dialog","Please Register Your Email To Ensure Password Recovery!\n"COLOR_RED"Invalid Email!","OK","Cancel"); 
        GameTextForPlayer(playerid, "~w~Email ~r~Invalid",1000,6); 
      } 
    } 
  } 
  if(dialogid == Sex) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Sex,DIALOG_STYLE_LIST,"Please Select Your Gender To Continue","Male\nFemale","Ok","Cancel"); 
    if(response) 
    { 
      switch(listitem) 
      { 
         case 0: 
         { 
           if(PlayerInfo[playerid][pChangeSexOnly] == 0) 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",1); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 1; 
             ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"---------Age--------","Please Enter Your Age To Continue","Ok","Cancel"); 
           } 
           else 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",1); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 1; 
             PlayerInfo[playerid][pChangeSexOnly] = 0; 
           } 
           return 1; 
         } 
         case 1: 
         { 
           if(PlayerInfo[playerid][pChangeSexOnly] == 0) 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",0); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 0; 
             ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"------Age------","Please Enter Your Age To Continue","Ok","Cancel"); 
           } 
           else 
           { 
             new INI:File = INI_Open(UserPath(playerid)); 
             INI_SetTag(File,"Player-Data"); 
             INI_WriteInt(File,"Sex",0); 
             INI_Close(File); 
             PlayerInfo[playerid][pSex] = 0; 
             PlayerInfo[playerid][pChangeSexOnly] = 0; 
           } 
         } 
      } 
    } 
  } 
  if(dialogid == Age) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Age,DIALOG_STYLE_INPUT,"--------Age--------","Please Enter Your Age To Continue","Ok","Cancel"); 
    if(response) 
    { 
      new INI:File = INI_Open(UserPath(playerid)); 
      INI_SetTag(File,"Player-Data"); 
      INI_WriteString(File,"Age",(inputtext)); 
      INI_Close(File); 
      ShowPlayerDialog(playerid,Orgin,DIALOG_STYLE_LIST,"--------Location--------","UK\nUSA","Ok","Cancel"); 
    } 
  } 
  if(dialogid == Orgin) 
  { 
    if(!response) return ShowPlayerDialog(playerid,Orgin,DIALOG_STYLE_LIST,"--------Location--------","UK\nUSA","Ok","Cancel"); 
    if(response) 
    { 
      switch(listitem) 
      { 
         case 0: 
         { 
           format(PlayerInfo[playerid][pOrgin], 255, "%s", "UK"); 
           new INI:File = INI_Open(UserPath(playerid)); 
           INI_SetTag(File,"Player-Data"); 
           INI_WriteString(File,"Orgin","UK"); 
           INI_Close(File); 
            
         } 
         case 1: 
         { 
           format(PlayerInfo[playerid][pOrgin], 255, "%s", "USA"); 
           new INI:File = INI_Open(UserPath(playerid)); 
           INI_SetTag(File,"Player-Data"); 
           INI_WriteString(File,"Orgin","USA"); 
           INI_Close(File); 
         } 
      } 
    } 
  } 
  if(dialogid == Login) 
  { 
    if(!response) return Kick(playerid); 
    if(response) 
    { 
      if(udb_hash(inputtext) != PlayerInfo[playerid][pPass]) 
      { 
        if(PlayerInfo[playerid][pLogOnAttempt] == 3) 
        { 
          Kick(playerid); 
          PlayerInfo[playerid][pLogOnAttempt] = 0; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 2) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"1 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 3; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 1) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"2 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 2; 
        } 
        if(PlayerInfo[playerid][pLogOnAttempt] == 0) 
        { 
          ShowPlayerDialog(playerid, Login, DIALOG_STYLE_PASSWORD,"Login System","Welcome Back. This Account Is Registered !!\nInsert Your Password To Login Into Your Account.\n"COLOR_RED"Incorrect Password!\n"COLOR_RED"3 Attempts Left!\n"COLOR_RED"Try Caps Lock!","Login","Quit"); 
          PlayerInfo[playerid][pLogOnAttempt] = 1; 
        } 
      } 
      else 
      { 
        INI_ParseFile(UserPath(playerid),"LoadUserAccounts", .bExtra = true, .extra = playerid); 
        GivePlayerMoney(playerid, PlayerInfo[playerid][pMoney]); 
        SetPlayerPos(playerid,PlayerInfo[playerid][X],PlayerInfo[playerid][Y],PlayerInfo[playerid][Z]); 
        SetPlayerFacingAngle(playerid,PlayerInfo[playerid][Angle]); 
        SetPlayerInterior(playerid,PlayerInfo[playerid][Interior]); 
        SetPlayerVirtualWorld(playerid,PlayerInfo[playerid][VirtualWorld]); 
        SendClientMessage(playerid,-1,""COLOR_ORANGE"Welcome Back!"COLOR_WHITE" You Have Been"COLOR_RED" Successfully"COLOR_WHITE" Logged In !!"); 
        new string[128]; 
        format(string, sizeof(string),COLOR_YELLOW"<<Player>>"COLOR_ORANGE" %s"COLOR_WHITE" Has Joined The Server !!", GetName(playerid)); 
        SendClientMessageToAll(-1, string); 
      } 
      return 1; 
    } 
} 
return 1; 
}
If I Help Rep+
Pulling something out of your gamemode won't help him.
Reply
#4

this my script now without agedialog, genderdialog :
PHP код:
#include <a_samp>
#include <a_mysql>
#include <zcmd>
#include <foreach>
#include "../include/gl_spawns.inc"
#include "../include/gl_common.inc"
#include <float>
#include <core>
#include <sscanf2>
#include <streamer>
#define    MYSQL_HOST        "localhost"
#define    MYSQL_USER        "root"
#define    MYSQL_DATABASE    "myserver"
#define    MYSQL_PASSWORD    ""
#define    SPAWN_X  1685.6680
#define    SPAWN_Y  -2332.9236
#define    SPAWN_Z  13.5469
#define    SPAWN_A  2.3834
#define COLOR_WHITE         0xFFFFFFFF
#define GAMETEXT_COLOR 1
enum
{
    
LoginDialog,
    
RegisterDialog,
    
AgeDialog,
    
GenderDialog,
    
EmailDialog
};
new
    
mysql;
    
native WP_Hash(buffer[], len, const str[]);
    
enum PlayerData
{
    
ID,
    
Name[MAX_PLAYER_NAME],
    
Password[129],
    
IP[16],
    
Admin,
    
VIP,
    
Money,
    
Float:posX,
    
Float:posY,
    
Float:posZ,
    
Float:posA
};
new 
Player[MAX_PLAYERS][PlayerData];
public 
OnGameModeInit()
{
    
AddPlayerClass(0,1685.6680,-2332.9236,13.5469,2.3834,0,0,0,0,0,0);
     
mysql_log(LOG_ALL);
    
mysql mysql_connect(MYSQL_HOSTMYSQL_USERMYSQL_DATABASEMYSQL_PASSWORD);
    if(
mysql_errno() != 0)
    {
        
printf("[MySQL] The connection has failed.");
    }
    else
    {
        
printf("[MySQL] The connection was successful.");
    }
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
   
SetPlayerColor(playeridCOLOR_WHITE);
   
SendClientMessage(playerid,COLOR_WHITE,"{FFFFFF}Welcome to {0000CD}Indonesia Real Life Roleplay");
     
SendClientMessage(playerid,COLOR_WHITE,"{FFFFFF}Visit {00FF00}www.new.IRL-RP.com {FFFFFF}to register new character!");
    new
        
query[128],
        
playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
mysql_format(mysqlquerysizeof(query), "SELECT `Password`, `ID` FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
    
mysql_tquery(mysqlquery"OnAccountCheck""i"playerid);
    return 
true;
}
forward OnAccountCheck(playerid);
public 
OnAccountCheck(playerid)
{
    
    new
        
rows,
        
fields,
        
name[MAX_PLAYER_NAME];
    
cache_get_data(rowsfieldsmysql);
     
GetPlayerName(playerid,name,sizeof(name));
    if(
rows)
    {
        new 
string1[400],string[400],ip[50];
        
GetPlayerIp(playeridipsizeof(ip));
        
cache_get_field_content(0"Password"Player[playerid][Password], mysql129);
        
Player[playerid][ID] = cache_get_field_content_int(0"ID");
        
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
        
strcat(string1,string);
        
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
        
strcat(string1,string);
        
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan Log In pada server.\n");
        
strcat(string1,string);
        
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Login",string1,"Log-in","Quit");
    }
    else
    {
        new 
string1[400],string[400],ip[50];
        
GetPlayerIp(playeridipsizeof(ip));
         
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
        
strcat(string1,string);
        
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
        
strcat(string1,string);
        
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan registrasi pada server ini.\n");
        
strcat(string1,string);
        
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_LIST,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Register",string1,"Register","Quit");
    }
    return 
true;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new
        
query[128],
        
Float:pos[4];
    
GetPlayerPos(playeridpos[0], pos[1], pos[2]);
    
GetPlayerFacingAngle(playeridpos[3]);
    
mysql_format(mysqlquerysizeof(query), "UPDATE `accounts` SET `Money` = %d, `PosX` = %f, `PosY` = %f, `PosZ` = %f, `PosA` = %f WHERE `ID` = %d",
    
GetPlayerMoney(playerid), pos[0], pos[1], pos[2], pos[3], Player[playerid][ID]);
    
mysql_tquery(mysqlquery"""");
        
TextDrawHideForPlayer(playeridTime), TextDrawHideForPlayer(playeridDate), TextDrawHideForPlayer(playeridIRLRP);
    return 
true;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
                 switch(
dialogid)
    {
        case 
LoginDialog:
        {
            if(!
responseKick(playerid);
            new
                
hashpass[129],
                
query[100],
                
name[MAX_PLAYER_NAME],
                
playername[MAX_PLAYER_NAME];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerName(playerid,name,sizeof(name));
            
WP_Hash(hashpasssizeof(hashpass), inputtext);
            if(!
strcmp(hashpassPlayer[playerid][Password]))
            {
                
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `accounts` WHERE `Name` = '%e' LIMIT 1"playername);
                
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
            }
            else
            {
                new 
string1[400],string[400],ip[50];
                 
GetPlayerIp(playeridipsizeof(ip));
                
SendClientMessage(playerid, -1"You have specified an incorrect password!");
                
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
                
strcat(string1,string);
                
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
                
strcat(string1,string);
                
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan Log In pada server.\n");
                
strcat(string1,string);
                
ShowPlayerDialog(playeridLoginDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Login",string1,"Log-in","Quit");
            }
        }
        case 
RegisterDialog:
        {
            if(!
response) return Kick(playerid);
            if(
strlen(inputtext) < 5)
            {
                
SendClientMessage(playerid, -1"Your password must at least contain more than 4 characters.");
                new 
string1[400],string[400],ip[50],name[MAX_PLAYER_NAME];
                
GetPlayerName(playerid,name,sizeof(name));
                
GetPlayerIp(playeridipsizeof(ip));
                 
format(string128"{FF0000}Indonesia Real Life Roleplay\n\n");
                
strcat(string1,string);
                
format(string128"{FFFFFF}Nama : {FF0000}%s\n{FFFFFF}IP : {FF0000}%s"nameip);
                
strcat(string1,string);
                
format(string128"\n\n{FFFFFF}Silahkan masukkan password anda untuk melakukan registrasi pada server ini.\n");
                 
strcat(string1,string);
                 return 
ShowPlayerDialog(playeridRegisterDialogDIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Register",string1,"Register","Quit");
            }
            new
                
query[512],
                
playername[MAX_PLAYER_NAME],
                
playerip[16];
            
GetPlayerName(playeridplayernamesizeof(playername));
            
GetPlayerIp(playeridplayeripsizeof(playerip));
            
WP_Hash(Player[playerid][Password], 129inputtext);
            
mysql_format(mysqlquerysizeof(query), "INSERT INTO `accounts` (`Name`, `Password`, `IP`, `Admin`, `VIP`, `Money`, `PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%e', '%e', '%e', 0, 0, 0, %f, %f, %f, %f)"playernamePlayer[playerid][Password], playeripSPAWN_XSPAWN_YSPAWN_ZSPAWN_A);
            
mysql_tquery(mysqlquery"OnAccountRegister""i"playerid);
        }
    }
    return 
false;
}
forward OnAccountLoad(playerid);
public 
OnAccountLoad(playerid)
{
   new 
name[MAX_PLAYER_NAME];
   new 
string[500];
   
GetPlayerName(playerid,name,sizeof(name));
    
Player[playerid][Admin] = cache_get_field_content_int(0"Admin");
    
Player[playerid][VIP] = cache_get_field_content_int(0"VIP");
    
Player[playerid][Money] = cache_get_field_content_int(0"Money");
    
Player[playerid][posX] = cache_get_field_content_float(0"PosX");
    
Player[playerid][posY] = cache_get_field_content_float(0"PosY");
    
Player[playerid][posZ] = cache_get_field_content_float(0"PosZ");
    
Player[playerid][posA] = cache_get_field_content_float(0"PosA");
    
GivePlayerMoney(playeridPlayer[playerid][Money]);
    
SetSpawnInfo(playerid061Player[playerid][posX], Player[playerid][posY], Player[playerid][posZ], Player[playerid][posA], 000000);
    
SpawnPlayer(playerid);
    
format(stringsizeof(string), "{0000CD}[SERVER] {FFFFFF}Welcome Back {00FF00}%s, {FFFFFF}you are now logged in."name);
    
SendClientMessage(playerid, -1string);
    return 
true;
}
forward OnAccountRegister(playerid);
public 
OnAccountRegister(playerid)
{
     new 
name[MAX_PLAYER_NAME];
   new 
string[500];
   
GetPlayerName(playerid,name,sizeof(name));
    
Player[playerid][ID] = cache_insert_id();
    
printf("[Registration] New account registered. Database ID: [%d]"Player[playerid][ID]);
    
SetSpawnInfo(playerid061SPAWN_XSPAWN_YSPAWN_ZSPAWN_A000000);
    
SpawnPlayer(playerid);
    
    
format(stringsizeof(string), "{0000CD}[SERVER] {FFFFFF}Welcome New Player {00FF00}%s, {FFFFFF}you are registered now."name);
    
SendClientMessage(playerid, -1string);
    return 
true;

How to add GenderDialog after create new password in RegisterDialog and add AgeDialog after select Gender in Gender Dialog??
Reply
#5

At case:RegisterDialog at the return

Код:
ShowPlayerDialog(playerid, RegisterDialog, DIALOG_STYLE_INPUT,"{FF0000}Indonesia Real Life Roleplay - {FF0000}Register",string1,"Register","Quit");
You need to change what I've highlighted with red. You put there what dialog you want it to appear next. For example, you want the age dialog to appear after that so you add:

Код:
ShowPlayerDialog(playerid, AgeDialog, DIALOG_STYLE_INPUT,"{FF0000}ENTER YOUR AGE {FF0000}Register",string1,"Enter","Quit");
You get the idea? Then at the age dialog you neeed to put

Код:
ShowPlayerDialog(playerid, GenderDialog, DIALOG_STYLE_INPUT,"Enter your gender{FF0000}Register",string1,"Enter","Quit");
I've made it as input, but you change it to whatever you need.
Reply
#6

Can you guys stop with the copy-paste suggestions... You're not helping.

That is not what this section is for...
Reply
#7

I opened it wanted to copy and paste but I just want to know how to make it, I can help solve it?
Reply
#8

Quote:
Originally Posted by Imbalo
Посмотреть сообщение
I opened it wanted to copy and paste but I just want to know how to make it, I can help solve it?
It's not a good thing to copy-paste because you're not learning anything, and people aren't helping you with anything at all.

You can't paste in these solutions as they are incomplete and require more to even get them working.

You need to learn to script some, or at least show what code you got to, to make it easier to help you, as right now, all you are asking someone to do, is do what you should be hiring someone for, which is to code for you.


This is not what the section is for.


It's not as if you are asking how it is to be done, you are asking someone to simply make what you've seen on another server, for you.


Your screenshot issue is also something, that if you ran SAMP as admin, would mysteriously fix itself.

If hat doesn't you have too many screenshots in the folder, or the folder itself (In My Documents) has incorrect permissions, or is non-existent.
Reply
#9

okey thanks Sew_Sumi
Reply
#10

Whatever code you made, you should throw some up... As I was saying, the pasted code that was put up, was incomplete and wasn't going to work anyway.

And let me know how your screenshot problem is going via my VMs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)