SA-MP Forums Archive
smail help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: smail help (/showthread.php?tid=535233)



smail help - nightday - 02.09.2014

hi,
i have problems i register after that i off and back again its tell me register again any help please
PHP код:
/*
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
    *
*/
#include <a_samp>
#include <dini>
#include <dudb>
#pragma unused ret_memcpy
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
enum pInfo
{
    
pAdminLevel,
    
pCash,
    
pScore,
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
new 
gPlayerLogged[MAX_PLAYERS];
#define SERVER_USER_FILE "myserver/%s.ini"
public OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Blank Filterscript by your name here");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
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 your not registered""Welcome, your not registered mate, input your registration pw below""Register""Leave");
    }
    if(
fexist(file))
    {
        
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi your registered""Fucken awesome mate, your registered :D. Inpute your pw 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 your not registered""Welcome, your not registered mate, input your registration pw 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];
        
GetPlayerName(playeridnamesizeof(name));
        
format(filesizeof(file), SERVER_USER_FILEname);
        if(!
response) return Kick(playerid);
        if (!
strlen(inputtext)) return ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi your registered""Fucken awesome mate, your registered :D. Inpute your pw below""Login""Leave");
        new 
tmp;
        
tmp dini_Int(file"Password");
        if(
udb_hash(inputtext) != tmp) {
            
SendClientMessage(playeridCOLOR_RED"Wrong PW sir.");
            
ShowPlayerDialog(playerid2DIALOG_STYLE_INPUT"Hi your registered""Fucken awesome mate, your registered :D. Inpute your pw 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 
1;

and its not save Text in Folder Script
And i Get From Server ....amx]: Run Time Error 20: "invalid index parramter


Re: smail help - Clad - 02.09.2014

Did you create the folder of saving users in Scriptfiles ?


Re: smail help - nightday - 02.09.2014

i make folder in file script its name users
and nothing happen


Re: smail help - nightday - 02.09.2014

any help its smail guys


Re: smail help - nightday - 02.09.2014

See
C:\Documents and Settings\NightDay\Desktop\MyServer\scriptfiles\use rs