Help please
#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


Messages In This Thread
Help please - by Imbalo - 22.03.2017, 04:17
Re: Help please - by Ayyash - 22.03.2017, 06:19
Re: Help please - by GoldenLion - 22.03.2017, 13:12
Re: Help please - by Imbalo - 22.03.2017, 16:19
Re: Help please - by Sibuscus - 22.03.2017, 19:14
Re: Help please - by Sew_Sumi - 22.03.2017, 20:31
Re: Help please - by Imbalo - 23.03.2017, 03:58
Re: Help please - by Sew_Sumi - 23.03.2017, 05:24
Re: Help please - by Imbalo - 23.03.2017, 06:30
Re: Help please - by Sew_Sumi - 23.03.2017, 12:30

Forum Jump:


Users browsing this thread: 2 Guest(s)