need help fast
#1

need help with my register system .. here is the system

pawn Код:
public OnPlayerConnect(playerid)
{
    new pname[MAX_PLAYER_NAME];
    new string[180];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has connected to the server",pname);
        MessageToAdmins(Grey, string);
    new playerfile[100];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(playerfile, sizeof(playerfile), "Reg/Users/%s.ini",pname);
        if (!dini_Exists(playerfile)) SendClientMessage(playerid, Yellow, "%s not found in our database, register an account");
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Register your account", "Enter a password", "Register", "Quit");
    if(dini_Exists(playerfile)) SendClientMessage(playerid, Green, "%s is registered login to your account");
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Login to your account", "Enter your password", "Login", "Quit");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    if(logged[playerid] == 1)
    {
    new playerfile[100], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(playerfile, sizeof(playerfile), "Reg/Users/%s.ini",pname);
    dini_IntSet(playerfile, "Level", level[playerid]);
    }
    level[playerid] = 0;
    logged[playerid] = 0;
    muted[playerid] = 0;
    new string[180], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, sizeof(string), "%s has left the server.",pname);
    MessageToAdmins(Grey, string);
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == 1)
    {
        new playerfile[128], pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));
        format(playerfile, sizeof(playerfile), "Reg/Users/%s.ini",pname);
        ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT,"Register your account","Enter a password","Register","Quit");
        new playerip[20];
        GetPlayerIp(playerid, playerip, sizeof(playerip));
        dini_Create(playerfile);
        dini_IntSet(playerfile, "Password", udb_hash(inputtext));
        dini_Set(playerfile, "Ip", playerip);
        dini_IntSet(playerfile, "Level", 0);
        logged[playerid] = 1;
    }
    if(dialogid == 2)
    {
    new playerfile[100], pname[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(playerfile, sizeof(playerfile), "Reg/Users/%s.ini",pname);
    new tmp[256];
    if(udb_hash(inputtext) != tmp) {
        SendClientMessage(playerid, Red,"Incorrect password!");
        ShowPlayerDialog(playerid,2,DIALOG_STYLE_INPUT,"Login to your account","Enter your password","Login","Quit");
    }
    else {
    tmp = dini_Get(playerfile, "Password");
    if(udb_hash(inputtext) == strval(tmp))
    return 1;
}
Quote:

E:\GTA San Andreas\Server\gamemodes\Test.pwn(634) : error 033: array must be indexed (variable "tmp")
E:\GTA San Andreas\Server\gamemodes\Test.pwn(644) : error 030: compound statement not closed at the end of file (started at line 630)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

When I connect, the dialogs doesnt even show and i just spawn in no where...

see my onplayerrequst

pawn Код:
{
    SetPlayerPos(playerid, 1383.1418,2185.1440,11.0234);
    SetPlayerFacingAngle(playerid, 0502);
    SetPlayerCameraPos(playerid, 1377.5685,2178.9609,11.0234);
    SetPlayerCameraLookAt(playerid, 1383.1418,2185.1440,11.0234);
        return 1;
       
}
Also the account doesnt saves, nothing saves in Reg/Users
Really bugged please help
Reply
#2

Anyone can help me ? If it needs to be rewritten, please do it
Reply
#3

pleasee help me, i cant do any admin commands because i think i missing the enums, please help me
Reply
#4

Код:
https://sampforum.blast.hk/showthread.ph....03318830a) Use a proper subject
b) Do not bump
Error 1: tmp is a string, you can't compare it with !=, use strcmp
Error 2: You're missing a couple of parentheses in if( dialogid == 2 )
Reply
#5

Could you be more specific

How should I change this

Код:
if(udb_hash(inputtext) != tmp) {
to strcmp?
Reply
#6

pawn Код:
if( !strcmp( udb_hash( inputtext ), tmp, false ) )
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)