Pawno.exe has stopped working!
#2

PHP код:
#include <a_samp>
#include <zcmd>
#include <YSI\y_ini>
// DEFINES
#define DIALOG_REGISTER 1
#define DIALOG_LOGIN 2
#define PATH "/Akauntovi.%s.ini"
#pragma tabsize 0
enum pInfo
{
    
pSifra,
    
pNovac,
    
pAdmin,
    
pScore,
    
pBankanovac,
    
pBanovan
}
new 
PlayerInfo[MAX_PLAYERS][pInfo];
forward LoadUser_data(playerid,name[],value[]);
public 
LoadUser_data(playerid,name[],value[])
{
    
INI_Int("Lozinka",PlayerInfo[playerid][pSifra]);
    
INI_Int("Novac",PlayerInfo[playerid][pNovac]);
    
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    
INI_Int("Score",PlayerInfo[playerid][pScore]);
    
INI_Int("Bankanovac",PlayerInfo[playerid][pBankanovac]);
    
INI_Int("Banovan",PlayerInfo[playerid][pBanovan]);
    return 
1;
}
stock UserPath(playerid)
{
    new 
string[128],playername[MAX_PLAYER_NAME];
    
GetPlayerName(playerid,playername,sizeof(playername));
    
format(string,sizeof(string),PATH,playername);
    return 
string;
}
stock udb_hash(buf[])
{
    new 
length=strlen(buf);
    new 
s1 1;
    new 
s2 0;
    new 
n;
    for (
n=0n<lengthn++)
    {
       
s1 = (s1 buf[n]) % 65521;
       
s2 = (s2 s1)     % 65521;
    }
    return (
s2 << 16) + s1;
}
main()
{
    print(
"<==============================>");
    print(
"               MOD OD 0            ");
    print(
"                BY ME.             ");
    print(
"<==============================>");
}
public 
OnGameModeInit()
{
    
// Don't use these lines if it's a filterscript
    
SetGameModeText("MJR v1.0.0");
    
AddPlayerClass(01958.37831343.157215.3746269.1425000000);
    return 
1;
}
public 
OnGameModeExit()
{
    return 
1;
}
public 
OnPlayerConnect(playerid)
{
    if(
fexist(UserPath(playerid)))
    {
        
INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra true,.extra playerid);
        
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Molimo unesite vaљu lozinku!","Login","Napusti");
    }
    else
    {
        
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Molimo da se registrujete na server!\nUnesite lozinku koju ћelite koristiti na serveru!","Register","Napusti");
    }
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    new 
INI:File INI_Open(UserPath(playerid));
    
INI_SetTag(File,"data");
    
INI_WriteInt(File,"Novac",GetPlayerMoney(playerid));
    
INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    
INI_WriteInt(File,"Score",GetPlayerScore(playerid));
    
INI_WriteInt(File,"Bankanovac",PlayerInfo[playerid][pBankanovac]);
    
INI_WriteInt(File,"Banovan",PlayerInfo[playerid][pBanovan]);
    
INI_Close(File);
    return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch(
dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if(!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register:","Lozinka koju ste unijeli nije validna!\nMolimo unesite novu!","Register","Napusti");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Lozinka",udb_hash(inputtext));
                
INI_WriteInt(File,"Novac",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Score",0);
                
INI_WriteInt(File,"Bankanovac",0);
                
INI_WriteInt(File,"Banovan",0);
                
INI_Close(File);
            }
        }
        case 
DIALOG_LOGIN:
        {
              if(!
response) return Kick(playerid);
            if(
response)
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pSifra])
                {
                    
INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra true,.extra playerid);
                    
GivePlayerMoney(playerid,PlayerInfo[playerid][pNovac]);
                    
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]);
                    
SendClientMessage(playerid,-1,"Uspjesno si se ulogovao u svoj korisnicki racun!");
                }
                else
                {
                    
ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login:","Lozinka koju ste unijeli nije tačna,pokuљajte ponovo!","Login","Napusti");
                }
            }
        }
    }
    return 
1;
}
public 
OnPlayerClickPlayer(playeridclickedplayeridsource)
{
    return 
1;

Reply


Messages In This Thread
Pawno.exe has stopped working! - by AhmAA - 24.03.2018, 19:47
Re: Pawno.exe has stopped working! - by v1k1nG - 24.03.2018, 20:08
Re: Pawno.exe has stopped working! - by AhmAA - 24.03.2018, 20:17
Re: Pawno.exe has stopped working! - by v1k1nG - 24.03.2018, 20:30
Re: Pawno.exe has stopped working! - by AhmAA - 24.03.2018, 20:34
Re: Pawno.exe has stopped working! - by v1k1nG - 24.03.2018, 20:38
Re: Pawno.exe has stopped working! - by kovac - 24.03.2018, 20:38
Re: Pawno.exe has stopped working! - by AhmAA - 24.03.2018, 20:39
Re: Pawno.exe has stopped working! - by AhmAA - 24.03.2018, 20:43
Re: Pawno.exe has stopped working! - by Grim_ - 25.03.2018, 02:44

Forum Jump:


Users browsing this thread: 3 Guest(s)