[Ajuda] Login
#1

Й o seguinte o problema nгo e "qualquer uma pass da para logar" o problema й se nгo tiver nenhum caratecter faz o login na mesma.

Se eu colocar uma password errada o sistema detecta, funciona direito!
Se eu colocar a password correcta o sistema detecta e faзo o login

Se eu nгo colocar nada e clicar enter o sistema faz o login!

Espero ter feito entender!

pawn Код:
if(dialogid == DialogLogin)
    {
    if(!response) ShowPlayerDialog(playerid, DialogExitLogin,DIALOG_STYLE_MSGBOX,"[PT] Red County RolePlay","{FFFFFF}Seras kickado por cancelar o login.\nNeste servidor e necessбrio fazer o login para poder jogar.","Ok","");
    if(response)
    {
    new string2[128];
    format(string2, sizeof(string2), "Sistema/Accounts/%s.ini", PlayerName(playerid));
    new File: UserFile = fopen(string2, io_read);
    if ( UserFile )
    {
    new PassData[256];
    new keytmp[256], valtmp[256];
    fread( UserFile , PassData , sizeof( PassData ) );
    keytmp = ini_GetKey( PassData );
    if( strcmp( keytmp , "Key" , true ) == 0 ) {
        valtmp = ini_GetValue( PassData );
        strmid(PlayerInfo[playerid][pKey], valtmp, 0, strlen(valtmp)-1, 255);
    }

    if(strcmp(PlayerInfo[playerid][pKey],inputtext, true ) == 0 ) {
        new key[ 256 ] , val[ 256 ];
        new Data[ 256 ];
        while ( fread( UserFile , Data , sizeof( Data ) ) ) {
            key = ini_GetKey( Data );
            if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
            if( strcmp( key , "AdminLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdmin] = strval( val ); }
            if( strcmp( key , "DonateRank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonateRank] = strval( val ); }
            if( strcmp( key , "Registered" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRegistered] = strval( val ); }
            if( strcmp( key , "Tutorial" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTut] = strval( val ); }
            if( strcmp( key , "Sex" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSex] = strval( val ); }
            if( strcmp( key , "Age" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAge] = strval( val ); }
            if( strcmp( key , "Experience" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pExp] = strval( val ); }
            if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
            if( strcmp( key , "Gun1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGun1] = strval( val ); }
            if( strcmp( key , "Gun2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGun2] = strval( val ); }
            if( strcmp( key , "Gun3" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGun3] = strval( val ); }
            if( strcmp( key , "Gun4" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGun4] = strval( val ); }
            if( strcmp( key , "Ammo1" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAmmo1] = strval( val ); }
            if( strcmp( key , "Ammo2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAmmo2] = strval( val ); }
            if( strcmp( key , "Ammo3" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAmmo3] = strval( val ); }
            if( strcmp( key , "Ammo4" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAmmo4] = strval( val ); }
            if( strcmp( key , "Bank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBank] = strval( val ); }
            if( strcmp( key , "Skin" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSkin] = strval( val ); }
            if( strcmp( key , "Car" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarKey] = strval( val ); }
            if( strcmp( key , "Car2" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarKey2] = strval( val ); }
            if( strcmp( key , "Car3" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarKey3] = strval( val ); }
            if( strcmp( key , "Crimes" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCrimes] = strval( val ); }
            if( strcmp( key , "Gold" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pGold] = strval( val ); }
            if( strcmp( key , "JobLevel" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJobLevel] = strval( val ); }
            if( strcmp( key , "Arrested" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pArrested] = strval( val ); }
            if( strcmp( key , "Drugs" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDrugs] = strval( val ); }
            if( strcmp( key , "Materials" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMaterials] = strval( val ); }
            if( strcmp( key , "Products" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pProducts] = strval( val ); }
            if( strcmp( key , "Job" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJob] = strval( val ); }
            if( strcmp( key , "ContractTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pContractTime] = strval( val ); }
            if( strcmp( key , "PlayingHours" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPlayingHours] = strval( val ); }
            if( strcmp( key , "AllowedPayday" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAllowedPayday] = strval( val ); }
            if( strcmp( key , "AllowedJob" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAllowedJob] = strval( val ); }
            if( strcmp( key , "PayCheck" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPayCheck] = strval( val ); }
            if( strcmp( key , "Faction" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFaction] = strval( val ); }
            if( strcmp( key , "Rank" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRank] = strval( val ); }
            if( strcmp( key , "HouseKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHouseKey] = strval( val ); }
            if( strcmp( key , "RentHouse" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRentHouse] = strval( val ); }
            if( strcmp( key , "BizKey" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBizKey] = strval( val ); }
            if( strcmp( key , "SpawnPoint" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnPoint] = strval( val ); }
            if( strcmp( key , "SpawnCity" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pSpawnCity] = strval( val ); }
            if( strcmp( key , "Warnings" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWarnings] = strval( val ); }
            if( strcmp( key , "CarLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCarLic] = strval( val ); }
            if( strcmp( key , "FlyLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFlyLic] = strval( val ); }
            if( strcmp( key , "WepLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pWepLic] = strval( val ); }
            if( strcmp( key , "FishLic" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFishLic] = strval( val ); }
            if( strcmp( key , "Cadastro" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCadastro] = strval( val ); }
            if( strcmp( key , "CadastroPerigoso" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCadastroPerigoso] = strval( val ); }
            if( strcmp( key , "PhoneNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneNumber] = strval( val ); }
            if( strcmp( key , "PhoneC" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneC] = strval( val ); }
            if( strcmp( key , "PhoneBook" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pPhoneBook] = strval( val ); }
            if( strcmp( key , "LottoNr" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLottoNr] = strval( val ); }
            if( strcmp( key , "ListNumber" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pListNumber] = strval( val ); }
            if( strcmp( key , "Mask" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMask] = strval( val ); }
            if( strcmp( key , "Fishes" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFishes] = strval( val ); }
            if( strcmp( key , "BiggestFish" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pBiggestFish] = strval( val ); }
            if( strcmp( key , "FishTool" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pFishTool] = strval( val ); }
            if( strcmp( key , "Donator" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDonator] = strval( val ); }
            if( strcmp( key , "Jailed" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailed] = strval( val ); }
            if( strcmp( key , "JailTime" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pJailTime] = strval( val ); }
            if( strcmp( key , "HeadValue" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHeadValue] = strval( val ); }
            if( strcmp( key , "Hospital" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pHospital] = strval( val ); }
            if( strcmp( key , "Note1" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pNote1], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "Note1s" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNote1s] = strval( val ); }
            if( strcmp( key , "Note2" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pNote2], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "Note2s" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNote2s] = strval( val ); }
            if( strcmp( key , "Note3" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pNote3], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "Note3s" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNote3s] = strval( val ); }
            if( strcmp( key , "Note4" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pNote4], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "Note4s" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNote4s] = strval( val ); }
            if( strcmp( key , "Note5" , true ) == 0 ) { val = ini_GetValue( Data ); strmid(PlayerInfo[playerid][pNote5], val, 0, strlen(val)-1, 255); }
            if( strcmp( key , "Note5s" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pNote5s] = strval( val ); }
            if( strcmp( key , "LoadPosX" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPosX] = floatstr( val ); }
            if( strcmp( key , "LoadPosY" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPosY] = floatstr( val ); }
            if( strcmp( key , "LoadPosZ" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPosZ] = floatstr( val ); }
            if( strcmp( key , "LoadPosInt" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPosInt] = strval( val ); }
            if( strcmp( key , "LoadPosW" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPosW] = strval( val ); }
            if( strcmp( key , "LoadPos" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLoadPos] = strval( val ); }
            if( strcmp( key , "AccountLocked" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLocked] = strval( val ); }
            if( strcmp( key , "Radio" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pRadio] = strval( val ); }
            if( strcmp( key , "MP4" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pMP4] = strval( val ); }
            if( strcmp( key , "Cigarros" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCigarros] = strval( val ); }
            if( strcmp( key , "ContaBanco" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pContaBanco] = strval( val ); }
            if( strcmp( key , "CartaoCidadao" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCC] = strval( val ); }
            if( strcmp( key , "AulasConducao" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAulasConducao] = strval( val ); }
            if( strcmp( key , "TesteConducao" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pTesteConducao] = strval( val ); }
            if( strcmp( key , "CartaoMultibanco" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCMB] = strval( val ); }
            if( strcmp( key , "Capacete" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCapacete] = strval( val ); }
            if( strcmp( key , "KMH" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKMH] = strval( val ); }
            if( strcmp( key , "AdminPure" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAdminPure] = strval( val ); }
            if( strcmp( key , "Anos" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pAnos] = strval( val ); }
            if( strcmp( key , "Caixa" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCaixa] = strval( val ); }
        }
        fclose(UserFile);
        }
        else
        {
        if(LoginAttempts[playerid] == MAX_LOGIN_ATTEMPTS)
        {
            KickPlayer(playerid,"um admin","Varias tentativas de fazer o login!");
            SendClientMessage(playerid,COLOR_LIGHTGREEN,"[Info:] Foste kickado por questхes de seguranзa");
            return 1;
        }
        LoginAttempts[playerid] ++;
        SendClientMessage(playerid, COLOR_GREY, "[Erro:] Password incorrecta!");
        new string[256];
        new pName[MAX_PLAYER_NAME];
        GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
        format(string, sizeof(string), "{FA0000}Password incorrecta!\n{FFFFFF}Por favor digite a password corretamente em baixo!",pName);
        ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Cancelar");
        fclose(UserFile);
        return 1;
    }
Reply
#2

Alguem me da uma ajuda ai?

Tou a pensar fazer tipo, se no inputtext nгo tiver nenhum caracter nгo deixa fazer login
mas nгo sei, ou melhor nao tenho ideia como se faz isso..

Tipo algo assim

new caracter = strval(inputtext);
Reply
#3

pawn Код:
if(!strlen(inputtext))
{
    SendClientMessage(playerid, -1 ," [ Server ] Digite uma senha.");
    return 1;
}
adicione isso caso o jogador nao digitar nada aparece isso
Reply
#4

resolvi

Coloquei
pawn Код:
new caracter = strval(inputtext);
if(strcmp(PlayerInfo[playerid][pKey],inputtext, true ) == 0 && caracter != 0) {
se a password conter 0 caracteres nгo vai funcionar foi facil, bastou pensar xD
Reply
#5

Quote:
Originally Posted by CJoao
Посмотреть сообщение
resolvi

Coloquei
pawn Код:
new caracter = strval(inputtext);
if(strcmp(PlayerInfo[playerid][pKey],inputtext, true ) == 0 && caracter != 0) {
se a password conter 0 caracteres nгo vai funcionar foi facil, bastou pensar xD
Reply
#6

Quote:
Originally Posted by Murilo_sousa
Посмотреть сообщение
pawn Код:
if(!strlen(inputtext))
{
    SendClientMessage(playerid, -1 ," [ Server ] Digite uma senha.");
    return 1;
}
adicione isso caso o jogador nao digitar nada aparece isso
Nem vi o seu post, mas obrigado na mesma +rep
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)