[DUV]Hatycone
#1

Entгo seguinte, eu fui tenta adapta um Login Box no [RPG]HatyCone.
Bom Olhe meu Script, se tiver algo errado me ajudem, nгo to conseguindo, e quando eu registro, nгo sei pq , mas diz q tenho q da /registrar ainda, tipo, voce reloga ai aparece o dialog de registro dnv, alguem me ajuda!
Script:

pawn Код:
#define DIALOG_LOGAR 500
#define DIALOG_REGISTRAR 501
ai no OnPlayerConnect eu substitui, a messagem dizendo /logar pra:
pawn Код:
if (udb_Exists(PlayerName(playerid))) {
    ShowPlayerDialog(playerid,500,DIALOG_STYLE_INPUT,"Sistema de Login","Digite sua Senha:","Logar","Cancelar");

    return 1;
}
    if (!udb_Exists(PlayerName(playerid))) {
    ShowPlayerDialog(playerid,501,DIALOG_STYLE_INPUT,"Sistema de Registro","Digite sua Senha:","Registrar","Cancelar");
    return 1;
}
Ai no OnDailog Response:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 500 && response == 0)
    {
    new tmp[256];
        //
        //
        if (udb_CheckLogin(PlayerName(playerid), tmp)) {
            PLAYERLIST_authed[playerid] = 1;
            LogarPlayer(playerid);
            printf("O jogador %s (ID %d) acabou de se logar",PlayerName(playerid),playerid);
            return 1;
        }
        else {
           // Login was incorrect
            SendClientMessage(playerid, COLOR_RED, "Vocк errou a Senha entгo foi Kickado.");
            Kick();
    }
    if(dialogid == 500 && response == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"Vocк clicou em Cancelar/ou apertou ESC, entгo foi kickado.");
        Kick(Playerid);
    }
//Mais coisas abaixo//
    if(dialogid == 501 && response == 0)
    {
        // The command shouldn't work if an account with this
        // nick already exists
        if (udb_Exists(PlayerName(playerid))) {
            SendClientMessage(playerid, COLOR_RED, "");
            return 1;
        }

        // The command shouldn't work if we already are authed
        if (PLAYERLIST_authed[playerid] == 1) {
            SendClientMessage(playerid, COLOR_RED, "");
            return 1;
        }

        // Did he forgot the password?
        if (strlen(tmp)==0) {
            SendClientMessage(playerid, COLOR_RED, "");
            return 1;
        }

        // We save the money to the accstate
        else{
            PLAYERLIST_authed[playerid] = 1;
//---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------E AQUI TB NO X Y Z --------------------------------------------------------//
            udb_Create(PlayerName(playerid), tmp /*senha*/,0 /*crйditos*/, 0 /*grana*/, 102 /*skin*/, 10000 /*gbanco*/, 100 /*gas*/, 0 /*har*/, 0 /*hterra*/, 0 /*hmar*/, 0 /*preso*/, 1 /*prof*/, ""/*clantag*/, -1757.9701/*X*/, 960.9874/*Y*/, 24.8828/*Z*/, 180.0000/*ang*/, 100.0 /*hp*/);
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
            new Float:X, Float:Y, Float:Z, Float:ang;
            udb_getPosition(PlayerName(playerid), X, Y, Z);
            udb_getAng(PlayerName(playerid), ang);
            udb_setGasoline(PlayerName(playerid), 100);
            Petrol[playerid] = 15;
//--------------------------------------------------------MUDE AKI NO X Y Z ---------------------------------------------------//
            SetSpawnInfo(playerid, 1, udb_getSkin(PlayerName(playerid)), X, Y, Z, ang, 0, 0, 0, 0, 0, 0);
//-----------------------------------------------------------------------------------------------------------------------------//
            SpawnPlayer(playerid);
            SetPlayerColor(playerid, COLOR_DESEMPREGADO);
            SendClientMessage(playerid, COLOR_GREEN, "Registrado e logado.");
            SendClientMessage(playerid, COLOR_GREEN, "Vocк tкm $10000 no banco para comeзar a viver + 100 de combustнvel.");
            printf("O jogador %s (ID %d) acabou de se registrar",PlayerName(playerid),playerid);
    }
    if(dialogid == 501 && response == 1)
    {
    SendClientMessage(playerid,COLOR_RED,"Vocк clicou em Cancelar/ou apertou ESC, entгo foi kickado.");
    Kick(Playerid);
    }
    return 1;
}
Alguem pode me ajudar? Grato =D
Reply
#2

usa um fs de login box,й muito melhor ^^

pega esse ki tб na minha assinatura
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)