SA-MP Forums Archive
[DUVIDA] Udb + Dialog - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [DUVIDA] Udb + Dialog (/showthread.php?tid=179178)



[DUVIDA] Udb + Dialog - oakley - 25.09.2010

Galera to com uma Duvida tenho meu servidor 0.2x
Agora to querendo atualizar para 0.3b
Como Tiro o /registrar e o /logar e coloko um Dialog de logar e registrar ?

pawn Код:
if(strcmp(cmd, "/registrar", true) == 0) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        // The command shouldn't work if an account with this
        // nick already exists
        if (udb_Exists(PlayerName(playerid))) {
            SendClientMessage(playerid, COLOR_RED, "Tб querendo se registrar duas vezes???");
            return 1;
        }

        // The command shouldn't work if we already are authed
        if (PLAYERLIST_authed[playerid] == 1) {
            SendClientMessage(playerid, COLOR_RED, "Vocк nгo pode se registrar logado!");
            return 1;
        }

        // Did he forgot the password?
        if (strlen(tmp)==0) {
            SendClientMessage(playerid, COLOR_RED, "Ei, vocк esqueceu de mencionar uma senha. Use /registrar [senha]");
            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*/, 5000 /*-->grana*/, 26 /*-->skin*/, 100 /*-->gbanco*/, 100 /*-->gas*/, 0 /*-->har*/, 0 /*-->hterra*/, 0 /*-->hmar*/, 0 /*-->preso*/, 1 /*-->prof*/, ""/*-->clantag*/, -322.1374/*-->X*/, 1056.4152/*-->Y*/, 19.7422/*-->Z*/, 313.8417/*-->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), 15);
            Petrol[playerid] = 15;
//--------------------------------------------------------MUDE AKI NO X Y Z ---------------------------------------------------//
            SetSpawnInfo(playerid, 1, udb_getSkin(PlayerName(playerid)), -322.1374,1056.4152,19.7422,313.8417,0,0,0,0,0,0);
//-----------------------------------------------------------------------------------------------------------------------------//
            SpawnPlayer(playerid);
            SetPlayerColor(playerid, COLOR_DESEMPREGADO);
            SendClientMessage(playerid, COLOR_GREEN, "Vocк tкm $5000 no banco para comeзar a viver e mais 20%% de combustнvel no tanque.");
            return 1;
        }
     }
//==============================================================================
    if(strcmp(cmd, "/logar", true) == 0 && IsPlayerConnected(playerid)) {
        new tmp[256];
        tmp = strtok(cmdtext, idx);
        // Tentativa de login sem registrar
        if (!udb_Exists(PlayerName(playerid))) {
            SendClientMessage(playerid, COLOR_RED, "[LOGIN]Para vocк poder se logar, й preciso se registrar primeiro.");
            return 1;
        }

        // Quando tenta loga de novo
        if (PLAYERLIST_authed[playerid] == 1) {
            SendClientMessage(playerid, COLOR_RED, "[LOGIN]Vocк sу pode se logar uma vez!");
            return 1;
        }

        // Quando tenta registrar mesmo tendo uma conta
        if (strlen(tmp)==0) {
            SendClientMessage(playerid, COLOR_RED, "[LOGIN]Vocк tem senha. Digite /logar [senha]");
            return 1;
        }
           // Quando ele loga ;D
        if (udb_CheckLogin(PlayerName(playerid),tmp)) {
            PLAYERLIST_authed[playerid] = 1;
            SetTimerEx("GanharLevel",30*60*1000, true, "i", playerid);
            LogarPlayer(playerid);
              udb_setProf(PlayerName(playerid), Profissao[playerid]);
            udb_setCreditos(PlayerName(playerid), Creditos[playerid]);
            udb_setGasoline(PlayerName(playerid), Petrol[playerid]);
            return 1;
        }
        else {
           // Quando a senha esta incorreta
            SendClientMessage(playerid, COLOR_RED, "[LOGIN]A senha nгo esta correta!");
            return 1;
        }
    }
Ta ai os cmds ...


Re: [DUVIDA] Udb + Dialog - oakley - 26.09.2010

Desculpe pelo Double Post !
Maas alguem pode me ajudar ai ?