Registration problem
#1

So I just got another computer and I lost all my gamemodes and all that. I am starting on new and I am trying to make a register system, but it doesnt work.

I followed a tutorial.


errors:
C:\GTA Server\gamemodes\testmode.pwn(279) : warning 204: symbol is assigned a value that is never used: "string"
C:\GTA Server\gamemodes\testmode.pwn(279 -- 302) : warning 217: loose indentation
C:\GTA Server\gamemodes\testmode.pwn(302) : error 029: invalid expression, assumed zero
C:\GTA Server\gamemodes\testmode.pwn(302) : error 004: function "OnPlayerClickPlayer" is not implemented
C:\GTA Server\gamemodes\testmode.pwn(307) : warning 225: unreachable code
C:\GTA Server\gamemodes\testmode.pwn(307) : error 029: invalid expression, assumed zero
C:\GTA Server\gamemodes\testmode.pwn(307) : error 004: function "OnPlayerCommandText" is not implemented
C:\GTA Server\gamemodes\testmode.pwn(311) : error 030: compound statement not closed at the end of file (started at line 259)

and here is the code:

pawn Код:
if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if(!response) return Kick(playerid);
        if (!strlen(inputtext)) return ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "You are registered. Input your password below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, 0xFFFFFFFF, "Wrong passord. Please re-enter");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "You are registered", "You are registered. Input your password below", "Login", "Leave");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SendClientMessage(playerid,0xFFFFFFFF, "You have successfully logged in!");
        }
        return 1;
    }

Thanks
Reply
#2

pawn Код:
///LOGIN-REGISTER///
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
    pGang,
    pGangLeader,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Accounts/%s.ini"

public OnPlayerConnect(playerid)
{
    //LOGIN-REGISTER
    TogglePlayerSpectating(playerid, true);
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256], string[128], lgin[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        format(string, 128, "Dobro došli na Populous RP server %s \nVaš account nije registriran na ovom serveru, molimo da se registrirate", name);
        ShowPlayerDialog(playerid, 3, DIALOG_STYLE_MSGBOX, "Registracija", string, "Registriraj se", "Odustani");
    }
    if(fexist(file))
    {
        format(lgin, 128, "Dobro došli %s \nUnesite svoju lozinku: ", name);
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", lgin, "Login", "Odusani");
    }
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    //LOGIN-REGISTER
    if (dialogid == 0)
    {
        if(response == 0)
        {
        Kick(playerid);
        }
        if(response == 1)
        {
        new name[MAX_PLAYER_NAME], file[256], string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        if (strlen(inputtext) < 5) return SendClientMessage(playerid,0xEF994300,"Lozinka nije dovoljno dugačka") && format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name) && ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
        if (strlen(inputtext) > 20) return SendClientMessage(playerid,0xEF994300,"Lozinka je predugačka") && format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name) && ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Gang",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "GangLeader",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
        format(string, 128, "Čestitamo! Uspješno ste registrirani! \nIme: %s \nLozinka: %s \nKako bi potvrdili svoju registraciju molimo da se ulogirate:", name, inputtext);
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Registracija", string, "Login", "Odusani");
        }
    }
    if (dialogid == 1)
    {
            new name[MAX_PLAYER_NAME], file[256], tmp, string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(file, sizeof(file), SERVER_USER_FILE, name);
            tmp = dini_Int(file, "Password");
            if(udb_hash(inputtext) != tmp)
            {
                SendClientMessage(playerid, 0xEF994300, "Kriva lozinka!");
                format(string, 128, "Dobro došli %s \nUnesite svoju lozinku: ", name);
                ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Login", string, "Login", "Odusani");
            }
            else
            {
                gPlayerLogged[playerid] = 1;
                PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
                PlayerInfo[playerid][pGang] = dini_Int(file, "Gang");
                PlayerInfo[playerid][pGangLeader] = dini_Int(file, "GangLeader");
                SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
                GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
                SetSpawnInfo(playerid, 0, 101, 2226.9934,-1160.0302,25.7671,88.9158,0,0,0,0,0,0);
                TogglePlayerSpectating(playerid, false);
            }
        }
    if(response == 0)
    {
        Kick(playerid);
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256], tmp, string[128];
        GetPlayerName(playerid, name, sizeof(name));
        format(file, sizeof(file), SERVER_USER_FILE, name);
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp)
        {
            SendClientMessage(playerid, 0xEF994300, "Kriva lozinka!");
            format(string, 128, "%s \nKako bi potvrdili svoju registraciju molimo da se ulogirate:", name);
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Registracija", string, "Login", "Odusani");
        }
        else
        {
            gPlayerLogged[playerid] = 1;
            PlayerInfo[playerid][pAdminLevel] = dini_Int(file, "AdminLevel");
            PlayerInfo[playerid][pGang] = dini_Int(file, "Gang");
            PlayerInfo[playerid][pGangLeader] = dini_Int(file, "GangLeader");
            SetPlayerScore(playerid, PlayerInfo[playerid][pScore]);
            GivePlayerMoney(playerid, dini_Int(file, "Money")-GetPlayerMoney(playerid));
            SetSpawnInfo(playerid, 0, 101, 2226.9934,-1160.0302,25.7671,88.9158,0,0,0,0,0,0);
            TogglePlayerSpectating(playerid, false);
        }
        if(response == 0)
        {
            Kick(playerid);
        }
   }

    if(dialogid == 3)
    {
        if(response == 1)
        {
            new name[MAX_PLAYER_NAME], file[256], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(file, sizeof(file), SERVER_USER_FILE, name);
            format(string, 128, "%s \nMolimo unesite svoju lozinku: \nNAPOMENA: Lozinka mora sadržavati najmanje 5 znakova i najvše 20 znakova!", name);
            ShowPlayerDialog(playerid, 0, DIALOG_STYLE_INPUT, "Registracija", string, "Registriraj se", "Odustani");
        }
        else
        {
        Kick(playerid);
        }
    }
    ///////////////////////////////////-----END----//////////////////////////////////////
    return 1;
}
Reply
#3

you are not using string[128]; so delete

put #pragma tabsize 0 at top under include sa-mp

for not implemented idk becouse i dont see
Reply
#4

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
you are not using string[128]; so delete

put #pragma tabsize 0 at top under include sa-mp

for not implemented idk becouse i dont see
Using #pragma tabsize is bad. Learn to indent mate
Reply
#5

I removed the string, thanks to jumbo for that.

I fixed the rest myself. I removed the 2 publics under.. Became much easier to go through the code then.

Anyways, thanks to you all.
Reply
#6

yeah bad use pragma for beginner you have 2 learn how to use TAB xD

but i dont use pragma
Reply
#7

Quote:
Originally Posted by [ISS]jumbo
Посмотреть сообщение
yeah bad use pragma for beginner you have 2 learn how to use TAB xD

but i dont use pragma
Your makin progress
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)