register questions, help pls
#1

Hey guys im new in pawn lenguage and im making a roleplay server from 0, and i want to put in screen when a player is trying to register ask the password, next step, ask player what gender is with 3 bottons Female - Male and Transgender, next step, ask player whats the origin with a list with some countries, and of course save it on the scripfiles player folder. I got this:

PHP код:
public OnPlayerConnect(playerid)
{
    
    
IdleTime[playerid] = 0;
    
    new 
string[128];
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
        
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,""COL_GTASARP"                                        Login Panel",""COL_WHITE"\nHello and Welcome back to "COL_GTASARP"Grand Theft Auto San Andreas Roleplay !\n\n"COL_WHITE"That nick is registered. Please enter your password below to log in:",""COL_SUCCESS"Login",""COL_FAILED"Quit"); //login
          
format(stringsizeof(string), ""COL_WHITE"Welcome back to "COL_GTASARP"Grand Theft Auto San Andreas Roleplay, "COL_WHITE"%s !"GetPlayerFirstName(playerid));
        
SendClientMessage(playerid, -1string);
        
SendClientMessage(playeridCOLOR_FAILED"NOTE: You MUST log in before spawning !");
    }
    else
    {
        
ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,""COL_GTASARP"                                              Registration Panel",""COL_WHITE"\n                      Hello and Welcome to "COL_GTASARP"Grand Theft Auto San Andreas Roleplay !\n\n"COL_WHITE"You dont have an account. Please register your account by typing the password below:",""COL_SUCCESS"Register",""COL_FAILED"Quit");
          
format(stringsizeof(string), ""COL_WHITE"Welcome to "COL_GTASARP"Grand Theft Auto San Andreas Roleplay, "COL_WHITE"%s !"GetPlayerFirstName(playerid));
        
SendClientMessage(playerid, -1string);
        
SendClientMessage(playeridCOLOR_FAILED"NOTE: You MUST register before spawning !");
    }
    if(!
IsValidName(playerid) && !IsPlayerNPC(playerid) && PlayerInfo[playerid][pAdmin] < 2)
    {
         
format(stringsizeof(string), ""COL_FAILED"Server Alert: %s has been kicked by Name_Checker, Reason: Invalid format name."GetName(playerid));
        
SendClientMessage(playeridCOLOR_FAILED"You've been kicked by Name_Checker, Reason: Invalid format name. (Firstname_Lastname)");
        
Kick(playerid);
    }
    
SetPlayerInterior(playerid,0);
    
TogglePlayerSpectating(playerid1);
    
gPlayerLogged[playerid] = 1;
    return 
1;

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    new 
tmp2[256];
    if(
IsPlayerConnected(playerid))
    {
        if(
dialogid == 1)
        {
            if (!
response) return Kick(playerid);
             if(
response)
              {
                   if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"You MUST register before spawning!","Welcome to Grand Theft Auto San Andreas Roleplay\n\nPlease register your account by typing the password below.","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                 
INI_WriteInt(File,"Password",udb_hash(inputtext));
                 
INI_WriteInt(File,"Cash",0);
                 
INI_WriteInt(File,"Skin",0);
                 
INI_WriteInt(File,"Level",0);
                 
INI_WriteInt(File,"Int",0);
                 
INI_WriteInt(File,"VW",0);
                 
INI_WriteInt(File,"Admin",0);
                 
INI_WriteInt(File,"SecKey",0);
                 
INI_WriteInt(File,"Kills",0);
                 
INI_WriteInt(File,"Deaths",0);
                   
INI_WriteFloat(File,"FacingAngle",0);
                
INI_WriteFloat(File,"Health",0);
                
INI_WriteFloat(File,"Armour",0);
                
INI_WriteFloat(File,"LastX",0);
                
INI_WriteFloat(File,"LastY",0);
                
INI_WriteFloat(File,"LastZ",0);
                
INI_WriteInt(File,"Faction",0);
                
INI_WriteInt(File,"Facrank",0);
                
INI_WriteInt(File,"Facleader",0);
                 
INI_Close(File);
                
SetSpawnInfo(playerid0299982.1890, -1624.258314.952690000000);
                   
SpawnPlayer(playerid);
                
ResetPlayerWeapons(playerid);
                
SetPlayerInterior(playerid,0);
                
SetPlayerVirtualWorld(playerid0);
                
SetPlayerScore(playerid1);
                
GivePlayerMoney(playerid1000);
                
SetCameraBehindPlayer(playerid);
                
PlayerInfo[playerid][pSkin] = 299;
                
PlayerInfo[playerid][pInt] = 0;
                
PlayerInfo[playerid][pVW] = 0;
                
PlayerInfo[playerid][pLevel] = 1;
                
SendClientMessage(playeridCOLOR_YELLOW"Account registered, you have been logged in automatically.");
                   
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~b~~h~   %s"GetName(playerid));
                
GameTextForPlayer(playeridtmp250001);
                
TogglePlayerSpectating(playerid0);
            }
           }
        if(
dialogid == 2)
           {
            if ( !
response ) return Kick playerid );
               if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                 {
                      
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                      
SetSpawnInfo(playerid0PlayerInfo[playerid][pSkin], PlayerInfo[playerid][pLastX], PlayerInfo[playerid][pLastY], PlayerInfo[playerid][pLastZ], PlayerInfo[playerid][pFacingAngle], 000000);
                    
SpawnPlayer(playerid);
                      
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                      
SetPlayerSkin(playeridPlayerInfo[playerid][pSkin]);
                      
SetPlayerScore(playeridPlayerInfo[playerid][pLevel]);
                    
SetPlayerHealth(playeridPlayerInfo[playerid][pHealth]);
                    
SetPlayerArmour(playeridPlayerInfo[playerid][pArmour]);
                    
SetPlayerInterior(playeridPlayerInfo[playerid][pInt]);
                    
SetPlayerVirtualWorld(playeridPlayerInfo[playerid][pVW]);
                       
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~b~~h~   %s"GetName(playerid));
                    
GameTextForPlayer(playeridtmp250001);
                    
TogglePlayerSpectating(playerid0);
                    if(
PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        
format(tmp2sizeof(tmp2), "SERVER: You are logged in as a Level %d Admin.",PlayerInfo[playerid][pAdmin]);
                        
SendClientMessage(playeridCOLOR_SUCCESS,tmp2);
                        
ShowPlayerDialog(playerid3,DIALOG_STYLE_INPUT,"                                        "COL_GTASARP"Admin Login Panel",""COL_WHITE"\nProvide your assigned security code for your admin account to be authorized.\n\n               Please enter your security code by typing the password below:",""COL_SUCCESS"Login",""COL_FAILED"Quit"); //admin authorization
                    
}
                 }
                   else
                   {
                       
ShowPlayerDialog(playerid,2,DIALOG_STYLE_PASSWORD,"Login","Welcome back to Grand Theft Auto Roleplay\n\nThat name is registered. Please enter your password below.","Login","Quit");
                   }
                   return 
1;
            }
        }
        if(
dialogid == 3)
        {
            if(
gAdminAuthorized[playerid] == 1)
            {
                
SendClientMessage(playeridCOLOR_SUCCESS"SERVER: Your admin account has already been authorized.");
                return 
1;
            }
            if(
response)
            {
                if(!
strlen(inputtext))
                {
                       
ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
                    
SendClientMessage(playeridCOLOR_WHITE"SERVER: You must enter your security code.");
                    return 
1;
                }
                if(
strlen(inputtext) >= 50)
                {
                    
ShowPlayerDialog(playerid,3,DIALOG_STYLE_INPUT,"Admin Login","Please provide your security code for your admin account to be authorized.\n\nPlease enter your security code below.","Login","Quit"); //admin authorization
                    
SendClientMessage(playeridCOLOR_FAILED"SERVER: Security code is too long.");
                    return 
0;
                }
                if(
fexist(UserPath(playerid)))
                {
                    new 
tmp;
                    new 
seckey strval(inputtext);
                    
tmp PlayerInfo[playerid][pSecKey];
                    if(
tmp == 0)
                    {
                        
SendClientMessage(playeridCOLOR_FAILED"SERVER: You do not have a valid Security Key.");
                        
Kick(playerid);
                        return 
1;
                    }
                    if(
seckey != tmp)
                      {
                        
SendClientMessage(playeridCOLOR_FAILED"SERVER: Security Key does not match. You have been kicked as a result.");
                        
Kick(playerid);
                        return 
1;
                    }
                    else
                    {
                        
gAdminAuthorized[playerid] = 1;
                        
SendClientMessage(playeridCOLOR_SUCCESS"SERVER: Your admin account has successfully been authorized.");
                         
format(tmp2sizeof(tmp2), "~w~Welcome ~n~~b~~h~   %s"GetName(playerid));
                        
GameTextForPlayer(playeridtmp250001);
                        
TogglePlayerSpectating(playerid0);
                        return 
1;
                    }
    }
            }
            else
            {
                
Kick(playerid);
            }
        }
    }
    return 
1;

I dont know if i made unnecessary things, since I also have an error, that when I log in with a new account to register, and I press the "escape" key while textdraw asks me what password I'm going to put on it, it ejects me from the server but the account is registered without a password.how can i solve it. sorry for my bad english. thanks in advance
Reply


Messages In This Thread
register questions, help pls - by Jaua10 - 31.07.2018, 06:17
Re: register questions, help pls - by Jaua10 - 31.07.2018, 15:51
Re: register questions, help pls - by Jaua10 - 31.07.2018, 17:08
Re: register questions, help pls - by KinderClans - 31.07.2018, 20:09
Re: register questions, help pls - by GRiMMREAPER - 31.07.2018, 20:20
Re: register questions, help pls - by KinderClans - 31.07.2018, 20:24
Re: register questions, help pls - by Rufio - 01.08.2018, 02:27
Re: register questions, help pls - by GTLS - 01.08.2018, 05:12
Re: register questions, help pls - by Jaua10 - 01.08.2018, 05:33
Re: register questions, help pls - by KinderClans - 01.08.2018, 17:09

Forum Jump:


Users browsing this thread: 1 Guest(s)