SA-MP Forums Archive
What's wrong ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: What's wrong ? (/showthread.php?tid=610041)



What's wrong ? - anonimus2222222 - 19.06.2016

Everything works perfectly but when I connect I want to say that is wrong password. What is wrong with the script?

Код HTML:
if(dialogid == REGISTER)
    {
       if(!strlen(inputtext)) return ShowPlayerDialog(playerid, REGISTER, DIALOG_STYLE_PASSWORD, "{FFFF00}Inregistrare", "{FF0000}Trebuie sa va inregistrati", "Register", "Inchide");
       if(!response) return Kick(playerid);
       if(response)
       {
          new INI:File = INI_Open(User(playerid));
          INI_WriteInt(File, "Password", udb_hash(inputtext));
          INI_Close(File);
          PlayerPlaySound(playerid, 1057, 0.0, 0.0, 0.0);
          SendClientMessage(playerid, 0x00FF00FF, "Te-ai inregistrat cu succes !");
          new String[256], Name[MAX_PLAYER_NAME], dd, mm, yy, h, m;
          GetPlayerName(playerid, Name, sizeof(Name));
          getdate(yy, mm, dd);
          gettime(h, m);
          format(String, sizeof(String), "{FFFFFF}Nume: {FFFF00}%s\n{FFFFFF}Data: {FFFF00}%02d/%02d/%02d\n{FFFFFF}Ora: {00FF00}%02d:%02d\n{FFFFFF}Parola: {FFFF00}%s\n{00773C}Apasa butonul 'F8' pentru a face o captura a ecranului.", Name, dd, mm, yy, h, m, inputtext);
          ShowPlayerDialog(playerid, 11, DIALOG_STYLE_MSGBOX, "{00FF00}Informatii inregistrare.", String, "Ok", "");
          DestroyRegistrationMenu(playerid);
       }
    }



Re: What's wrong ? - SyS - 19.06.2016

what? i dont understood your english i think you are refering to login system not the register thing and your password is not checking correctly right? show your login dialog


Re: What's wrong ? - anonimus2222222 - 29.06.2016

PHP код:
if(dialogid == LOGIN)
    {
       if(!
response) return Kick(playerid);
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare""{FF0000}Trebuie sa te conectezi.""Connect""Iesire");
       if(
response)
       {
          
INI_ParseFile(User(playerid), "PlayerData_%s", .bExtra true, .extra playerid);
          if(
udb_hash(inputtext) == pInfo[playerid][Pass])
          {
             
SpawnPlayer(playerid);
             
SetPlayerPos(playeridpInfo[playerid][x], pInfo[playerid][y], pInfo[playerid][z]);
             
SetPlayerFacingAngle(playeridpInfo[playerid][a]);
             
GivePlayerMoney(playeridpInfo[playerid][Cash]);
             
SetPlayerScore(playeridpInfo[playerid][Score]);
             
pInfo[playerid][Kills] = pInfo[playerid][Kills];
             
pInfo[playerid][Deaths] = pInfo[playerid][Deaths];
             
PlayerPlaySound(playerid10570.00.00.0);
             
SendClientMessage(playerid0x00FF00FF"Ai fost conectat pe server cu succes.");
             
DestroyRegistrationMenu(playerid);
          }
          else
          {
             if(
Attempts[playerid] <= 2)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
Attempts[playerid] ++;
                new 
String[128];
                
format(Stringsizeof(String), "{FF0000}Parola gresita {FFFF00}%d/3 {FFFFFF}incercari."Attempts[playerid]);
                
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare"String"Connect""Iesire");
             }
             if(
Attempts[playerid] == 3)
             {
                
PlayerPlaySound(playerid10580.00.00.0);
                
ShowPlayerDialog(playerid12DIALOG_STYLE_MSGBOX"{FF0000}Conectare epuizata""{FF0000}Ai fost dat afara pentru ca ai gresit parola de conectare de 3 ori.""Am inteles.""");
                
SetTimerEx("KickForBadLogin"500false"i"playerid);
                
DestroyRegistrationMenu(playerid);
             }
          }
       }
    } 



Re: What's wrong ? - SyS - 29.06.2016

can u show the loading function something with PlayerData_blahblah


Re: What's wrong ? - anonimus2222222 - 29.06.2016

PHP код:
forward PlayerData_Data(playeridname[], value[]);
public 
PlayerData_Data(playeridname[], value[])
{
    
INI_Int("Password"pInfo[playerid][Pass]);
    
INI_Float("X"pInfo[playerid][x]);
    
INI_Float("Y"pInfo[playerid][y]);
    
INI_Float("Z"pInfo[playerid][z]);
    
INI_Float("A"pInfo[playerid][a]);
    
INI_Int("Cash"pInfo[playerid][Cash]);
    
INI_Int("Score"pInfo[playerid][Score]);
    
INI_Int("Kills"pInfo[playerid][Kills]);
    
INI_Int("Deaths"pInfo[playerid][Deaths]);
    return 
1;




Re: What's wrong ? - SyS - 29.06.2016

PHP код:
if(dialogid == LOGIN
    { 
       if(!
response) return Kick(playerid); 
       if(!
strlen(inputtext)) return ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare""{FF0000}Trebuie sa te conectezi.""Connect""Iesire"); 
       if(
response
       { 
          
INI_ParseFile(User(playerid), "PlayerData_Data", .bExtra true, .extra playerid); 
          if(
udb_hash(inputtext) == pInfo[playerid][Pass]) 
          { 
             
SpawnPlayer(playerid); 
             
SetPlayerPos(playeridpInfo[playerid][x], pInfo[playerid][y], pInfo[playerid][z]); 
             
SetPlayerFacingAngle(playeridpInfo[playerid][a]); 
             
GivePlayerMoney(playeridpInfo[playerid][Cash]); 
             
SetPlayerScore(playeridpInfo[playerid][Score]); 
             
pInfo[playerid][Kills] = pInfo[playerid][Kills]; 
             
pInfo[playerid][Deaths] = pInfo[playerid][Deaths]; 
             
PlayerPlaySound(playerid10570.00.00.0); 
             
SendClientMessage(playerid0x00FF00FF"Ai fost conectat pe server cu succes."); 
             
DestroyRegistrationMenu(playerid); 
          } 
          else 
          { 
             if(
Attempts[playerid] <= 2
             { 
                
PlayerPlaySound(playerid10580.00.00.0); 
                
Attempts[playerid] ++; 
                new 
String[128]; 
                
format(Stringsizeof(String), "{FF0000}Parola gresita {FFFF00}%d/3 {FFFFFF}incercari."Attempts[playerid]); 
                
ShowPlayerDialog(playeridLOGINDIALOG_STYLE_PASSWORD"{FF0000}Conectare"String"Connect""Iesire"); 
             } 
             if(
Attempts[playerid] == 3
             { 
                
PlayerPlaySound(playerid10580.00.00.0); 
                
ShowPlayerDialog(playerid12DIALOG_STYLE_MSGBOX"{FF0000}Conectare epuizata""{FF0000}Ai fost dat afara pentru ca ai gresit parola de conectare de 3 ori.""Am inteles."""); 
                
SetTimerEx("KickForBadLogin"500false"i"playerid); 
                
DestroyRegistrationMenu(playerid); 
             } 
          } 
       } 
    } 
try above code i just changed
PHP код:
INI_ParseFile(User(playerid), "PlayerData_%s", .bExtra true, .extra playerid); 
to
PHP код:
INI_ParseFile(User(playerid), "PlayerData_Data", .bExtra true, .extra playerid); 



Re: What's wrong ? - anonimus2222222 - 29.06.2016

Thank you man. Rep !