#1

code:
PHP код:
#pragma unused ret_memcpy
#include <a_samp>
#include <dini>
#include <dudb>
#define COLOR_YELLOW 0xFFFF00AA
enum pInfo
{
    
pAdminLevel,
    
pCash,
    
pScore,
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
new 
gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Register_Dialog/Users/%s.ini"
public OnPlayerConnect(playerid)
{
gPlayerLogged[playerid] = 0;
    new 
name[MAX_PLAYER_NAME], file[256];
    
GetPlayerName(playeridnamesizeof(name));
    
format(filesizeof(file), SERVER_USER_FILEname);
    if (!
dini_Exists(file))
    {
        
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Hi you are not registered""Welcome, you are not registered. to register please input your registration password below""Register""Leave");
    }
    if(
fexist(file))
    {
        
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi you are registered""you are already registered. to login please Inpute your password below""Login""Leave");
    }
return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
new 
name[MAX_PLAYER_NAME], file[256];
    
GetPlayerName(playeridnamesizeof(name));
    
format(filesizeof(file), SERVER_USER_FILEname);
    if(
gPlayerLogged[playerid] == 1)
    {
        
dini_IntSet(file"Score"PlayerInfo[playerid][pScore]);
        
dini_IntSet(file"Money"PlayerInfo[playerid][pCash]);
        
dini_IntSet(file"AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    
gPlayerLogged[playerid] = 0;
return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
if (
dialogid == 1)
    {
        new 
name[MAX_PLAYER_NAME], file[256], string[128];
        
GetPlayerName(playeridnamesizeof(name));
        
format(filesizeof(file), SERVER_USER_FILEname);
        if(!
response) return Kick(playerid);
        if (!
strlen(inputtext)) return
ShowPlayerDialog(playerid1DIALOG_STYLE_INPUT"Hi you are not registered""Welcome, you are not registered. to register please input your registration password below""Register""Leave");
        
dini_Create(file);
        
dini_IntSet(file"Password"udb_hash(inputtext));
        
dini_IntSet(file"AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        
dini_IntSet(file"Money",PlayerInfo[playerid][pCash] = 500);
        
dini_IntSet(file"Score",PlayerInfo[playerid][pScore] = 0);
        
format(string128"[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in."nameinputtext);
        
SendClientMessage(playeridCOLOR_YELLOWstring);
        
gPlayerLogged[playerid] = 1;
    }
if (
dialogid == 2)
    {
        new 
name[MAX_PLAYER_NAME], file[256], string[128];
        
GetPlayerName(playeridnamesizeof(name));
        
format(filesizeof(file), SERVER_USER_FILEname);
        if(!
response) return Kick(playerid);
        if (!
strlen(inputtext)) return ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi you are registered""you are already registered. to login please Inpute your password below""Login""Leave");
        new 
tmp;
        
tmp dini_Int(file"Password");
        if(
udb_hash(inputtext) != tmp) {
            
SendClientMessage(playeridCOLOR_RED"You entered the wrong password.");
            
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi you are registered""you are already registered. to login please Inpute your password below""Login""Leave");
        }
        else
        {
            
gPlayerLogged[playerid] = 1;
            
PlayerInfo[playerid][pAdminLevel] = dini_Int(file"AdminLevel");
            
SetPlayerScore(playeridPlayerInfo[playerid][pScore]);
            
GivePlayerMoney(playeriddini_Int(file"Money")-GetPlayerMoney(playerid));
            
SendClientMessage(playerid,COLOR_RED"[SYSTEM]: Successfully logged in!");
        }
    }
 return 
0;

errors:
PHP код:
D:\gta san andreas online\Godfucker\pawno\include\dutils.inc(28) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(132) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(172) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(280) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(298) : warning 219local variable "tmp" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(337) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(379) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dutils.inc(462) : warning 219local variable "tmp" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\pawno\include\dini.inc(46) : warning 219local variable "tmp" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(19) : warning 217loose indentation
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(19) : warning 219local variable "name" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(19) : warning 219local variable "file" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(30) : warning 217loose indentation
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(35) : warning 219local variable "name" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(35) : warning 219local variable "file" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(36) : warning 217loose indentation
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(45) : warning 217loose indentation
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(51) : warning 219local variable "name" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(51) : warning 219local variable "file" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(51) : warning 219local variable "string" shadows a variable at a preceding level
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(67) : warning 209: function "OnDialogResponse" should return a value
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(67) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(70) : error 021symbol already defined"GetPlayerName"
D:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(72) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(73) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(75) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(76) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(80) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(91) : error 010invalid function or declaration
D
:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(94) : warning 203symbol is never used"file"
D:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(94) : warning 203symbol is never used"name"
D:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(94) : warning 203symbol is never used"string"
D:\gta san andreas online\Godfucker\My Fs\Register System Dialog\Register_Dialog.pwn(94) : warning 203symbol is never used"tmp"
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
8 Errors

Reply
#2

pawn Код:
#pragma unused ret_memcpy
#include <a_samp>
#include <dini>
#include <dudb>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Register_Dialog/Users/%s.ini"

public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi you are not registered", "Welcome, you are not registered. to register please input your registration password below", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi you are registered", "you are already registered. to login please Inpute your password below", "Login", "Leave");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        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, 1, DIALOG_STYLE_INPUT, "Hi you are not registered", "Welcome, you are not registered. to register please input your registration password below", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        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, "Hi you are registered", "you are already registered. to login please Inpute your password below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "You entered the wrong password.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi you are registered", "you are already registered. to login please Inpute 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,COLOR_RED, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 0;
}
Reply
#3

btw its pawn not php
Reply
#4

Quote:
Originally Posted by Clive
Посмотреть сообщение
pawn Код:
#pragma unused ret_memcpy
#include <a_samp>
#include <dini>
#include <dudb>
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
enum pInfo
{
    pAdminLevel,
    pCash,
    pScore,
}
new PlayerInfo[MAX_PLAYERS][pInfo];
new gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "Register_Dialog/Users/%s.ini"

public OnPlayerConnect(playerid)
{
    gPlayerLogged[playerid] = 0;
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if (!dini_Exists(file))
    {
        ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Hi you are not registered", "Welcome, you are not registered. to register please input your registration password below", "Register", "Leave");
    }
    if(fexist(file))
    {
        ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi you are registered", "you are already registered. to login please Inpute your password below", "Login", "Leave");
    }
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Score", PlayerInfo[playerid][pScore]);
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel]);
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if (dialogid == 1)
    {
        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, 1, DIALOG_STYLE_INPUT, "Hi you are not registered", "Welcome, you are not registered. to register please input your registration password below", "Register", "Leave");
        dini_Create(file);
        dini_IntSet(file, "Password", udb_hash(inputtext));
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdminLevel] = 0);
        dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
        dini_IntSet(file, "Score",PlayerInfo[playerid][pScore] = 0);
        format(string, 128, "[SYSTEM]: You succesfully registered the nickname %s with password %s, you have been auto logged in.", name, inputtext);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        gPlayerLogged[playerid] = 1;
    }
    if (dialogid == 2)
    {
        new name[MAX_PLAYER_NAME], file[256];
        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, "Hi you are registered", "you are already registered. to login please Inpute your password below", "Login", "Leave");
        new tmp;
        tmp = dini_Int(file, "Password");
        if(udb_hash(inputtext) != tmp) {
            SendClientMessage(playerid, COLOR_RED, "You entered the wrong password.");
            ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Hi you are registered", "you are already registered. to login please Inpute 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,COLOR_RED, "[SYSTEM]: Successfully logged in!");
        }
    }
    return 0;
}
it crashes the pawn!!! anyone knows how to fix my problem?
Reply
#5

Quote:
Originally Posted by omer5198
Посмотреть сообщение
it crashes the pawn!!! anyone knows how to fix my problem?
But not for me.
Reply
#6

Quote:
Originally Posted by Clive
Посмотреть сообщение
Not crashing for me.
i tryed again it it works... thx! can you plz tell me what you changed?
b.t.w sorry for my bad english
Reply
#7

Quote:
Originally Posted by omer5198
Посмотреть сообщение
i tryed again it it works... thx! can you plz tell me what you changed?
b.t.w sorry for my bad english
I've just added a '{' OnDialogResponse..
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)