[Pomoc] Lozinka

Započeo 96esl., Novembar 05, 2013, 21:53:43 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 1 gost pregledaju ovu temu.

Skripta koju koristim: Moja
Detaljan opis problema: Problem sa lozinkom mogu uci s bilo kojom lozinkom evo kod dole ,stvarno ne znam gdje sam pogresio
Dio skripte: Oko lozinke
Neke slike/video za lakse dobivanje pomoci(neobavezno):
// This is a comment

/* #INCLUDE'S */

#include	<a_samp>
#include    <sscanf2>
#include 	<streamer>
#include	<YSI\y_ini>

native WP_Hash(buffer[], len, const str[]);

/* #DEFINE'S */

#define		SERVER_MODE "X RolePlay"
#define		PATH "Users/%s.ini"
#define 	function%0(%1)	forward %0(%1); public %0(%1)

/* #DIALOG'S */

#define DIALOG_REGISTER		1
#define DIALOG_LOGIN		2

//* #COLOR'S */
#define RED 				0xA10000FF
#define WHITE				0xFFFFFFFF
#define GREEN 				0x9FFF00FF
#define YELLOW 				0xFFFF00FF
#define LBLUE				0x298ACFFF

#define CRED            	"{A10000}"
#define CWHITE          	"{FFFFFF}"
#define CGREEN         	 	"{6EF83C}"
#define CLBLUE          	"{298ACF}"
#define CYELLOW         	"{F3FF02}"

/* #ENUM */

enum PLAYERDATA
{
    Password[129],
    Admin,
    Kills,
    Deaths,
    Money
}
new PlayerData[MAX_PLAYERS][PLAYERDATA];

/* #NEW'S */

new dString[512];

main()
{

}

public OnGameModeInit()
{
	SetGameModeText(SERVER_MODE);
	AddPlayerClass(28, 1743.1090,-1863.6298,13.5748,18.0448,0,0,0,0,0,0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    { 
        INI_ParseFile(UserPath(playerid),"user_%s", .bExtra = true, .extra = playerid);
        
        format(dString, sizeof(dString),""CWHITE"DobrodoÅ¡ao "CLBLUE"%s "CWHITE"na X RolePlay\n\nVaÅ¡ korisnički račun pronaÄ'en.\nU prazno polje upiÅ¡ite svoju lozinku za pristup serveru.", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "X RolePlay - Login", dString, "Login", "Quit");
    } 
    else 
    { 
        format(dString, sizeof(dString), ""CWHITE"DobrodoÅ¡ao "CLBLUE"%s "CWHITE"na X RolePlay\n\nVaÅ¡ korisnički račun nije pronaÄ'en.\nU prazno polje upiÅ¡ite željenu lozinku za registraciju.", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "X RolePlay - Register", dString, "Register", "Quit");
        
    } 
    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    new INI:playerFile = INI_Open(UserPath(playerid));
	INI_SetTag(playerFile, "statistics");
    INI_WriteInt(playerFile, "Admin", PlayerData[playerid][Admin]);
    INI_WriteInt(playerFile, "Kills", PlayerData[playerid][Kills]);
    INI_WriteInt(playerFile, "Deaths", PlayerData[playerid][Deaths]);
    INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
    INI_Close(playerFile);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerData[killerid][Kills] += 1;
    PlayerData[playerid][Deaths] += 1;
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) 
    { 
        case DIALOG_REGISTER:
        { 
            if(!response) return Kick(playerid);
            if(response)
            { 
                if(strlen(inputtext) >= 5 && strlen(inputtext) <= 20)
                { 
                    new WPHash[129];
                    WP_Hash(WPHash, sizeof(WPHash), inputtext);
					new INI:playerFile = INI_Open(UserPath(playerid));
					INI_SetTag(playerFile, "statistics");
				    INI_WriteString(playerFile, "Password", WPHash);
				    INI_WriteInt(playerFile, "Admin", 0);
				    INI_WriteInt(playerFile, "Kills", 0);
				    INI_WriteInt(playerFile, "Deaths", 0);
				    INI_WriteInt(playerFile, "Money", 0);
				    INI_Close(playerFile);
                    
                    format(dString, sizeof(dString), "UspjeÅ¡no ste se registrirali pod imenom "CWHITE"'%s' "CRED"i lozinkom "CWHITE"'%s'"CRED". Zahvaljujemo na registracij!", GetName(playerid), inputtext);
                    SendClientMessage(playerid, RED, dString);
                } 
                else 
                { 
                    format(dString, sizeof(dString), ""CLBLUE"%s "CWHITE"upisali ste prekratku ili preveliku lozinku.\n\nVaÅ¡ lozinka mora sadržavati najmanje "CLBLUE"5 "CWHITE", a najviÅ¡e "CLBLUE"20 "CWHITE"znaka.", GetName(playerid));
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "X RolePlay - Register", dString, "Register", "Quit");
                } 
            } 
        } 
        case DIALOG_LOGIN: 
        { 
            if(!response) return Kick(playerid);
            if(response)
            {
                new WPHash[129];
                WP_Hash(WPHash, sizeof(WPHash), inputtext);
				if(!strcmp(WPHash, PlayerData[playerid][Password], false))
				{
					INI_ParseFile(UserPath(playerid), "user_%s", .bExtra = true, .extra = playerid);
		    	}
                else 
                {
                    format(dString, sizeof(dString), ""CLBLUE"%s "CWHITE"upisali ste pogreÅ¡nu lozinku.\nMolimo u prazno polje upiÅ¡ite ispravnu lozinku za pristup serveru.", GetName(playerid));
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "X RolePlay - Login", dString, "Login", "Quit");
                } 
            } 
        } 
    } 
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

/* #FUNCTION */

function user_data(playerid, name[], value[])
{
    INI_String("Password", PlayerData[playerid][Password], 129);
    INI_Int("Admin", PlayerData[playerid][Admin]);
    INI_Int("Kills", PlayerData[playerid][Kills]);
    INI_Int("Deaths", PlayerData[playerid][Deaths]);
    INI_Int("Money", PlayerData[playerid][Money]);
    return 1;
}

/* #STOCK */

stock UserPath(playerid)
{
    new string[128], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), PATH, Name);
    return string;
}

stock GetName(playerid) 
{ 
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    return Name;
}

/*____________________________________________________________________________*/

Probaj ovako:
// This is a comment

/* #INCLUDE'S */

#include	<a_samp>
#include    <sscanf2>
#include 	<streamer>
#include	<YSI\y_ini>

native WP_Hash(buffer[], len, const str[]);

/* #DEFINE'S */

#define		SERVER_MODE "X RolePlay"
#define		PATH "Users/%s.ini"
#define 	function%0(%1)	forward %0(%1); public %0(%1)

/* #DIALOG'S */

#define DIALOG_REGISTER		1
#define DIALOG_LOGIN		2

//* #COLOR'S */
#define RED 				0xA10000FF
#define WHITE				0xFFFFFFFF
#define GREEN 				0x9FFF00FF
#define YELLOW 				0xFFFF00FF
#define LBLUE				0x298ACFFF

#define CRED            	"{A10000}"
#define CWHITE          	"{FFFFFF}"
#define CGREEN         	 	"{6EF83C}"
#define CLBLUE          	"{298ACF}"
#define CYELLOW         	"{F3FF02}"

/* #ENUM */

enum PLAYERDATA
{
    Password[129],
    Admin,
    Kills,
    Deaths,
    Money
}
new PlayerData[MAX_PLAYERS][PLAYERDATA];

/* #NEW'S */

new dString[512];

main()
{

}

public OnGameModeInit()
{
	SetGameModeText(SERVER_MODE);
	AddPlayerClass(28, 1743.1090,-1863.6298,13.5748,18.0448,0,0,0,0,0,0);
	return 1;
}

public OnGameModeExit()
{
	return 1;
}

public OnPlayerRequestClass(playerid, classid)
{
	return 1;
}

public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
    {
    format(string,sizeof(string),"/Users/%s.ini",ime2);
	INI_ParseFile(string, "user_data_%s", .bExtra = true, .extra = playerid);
        format(dString, sizeof(dString),""CWHITE"DobrodoÅ¡ao "CLBLUE"%s "CWHITE"na X RolePlay\n\nVaÅ¡ korisnicki racun pronaden.\nU prazno polje upiÅ¡ite svoju lozinku za pristup serveru.", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "X RolePlay - Login", dString, "Login", "Quit");
    }
    else
    {
        format(dString, sizeof(dString), ""CWHITE"DobrodoÅ¡ao "CLBLUE"%s "CWHITE"na X RolePlay\n\nVaÅ¡ korisnicki racun nije pronaden.\nU prazno polje upiÅ¡ite željenu lozinku za registraciju.", GetName(playerid));
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "X RolePlay - Register", dString, "Register", "Quit");

    }
    return 1;
}


public OnPlayerDisconnect(playerid, reason)
{
    new INI:playerFile = INI_Open(UserPath(playerid));
	INI_SetTag(playerFile, "statistics");
    INI_WriteInt(playerFile, "Admin", PlayerData[playerid][Admin]);
    INI_WriteInt(playerFile, "Kills", PlayerData[playerid][Kills]);
    INI_WriteInt(playerFile, "Deaths", PlayerData[playerid][Deaths]);
    INI_WriteInt(playerFile, "Money", GetPlayerMoney(playerid));
    INI_Close(playerFile);
	return 1;
}

public OnPlayerSpawn(playerid)
{
	return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    PlayerData[killerid][Kills] += 1;
    PlayerData[playerid][Deaths] += 1;
	return 1;
}

public OnVehicleSpawn(vehicleid)
{
	return 1;
}

public OnVehicleDeath(vehicleid, killerid)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	return 1;
}

public OnPlayerExitVehicle(playerid, vehicleid)
{
	return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
	return 1;
}

public OnPlayerEnterCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveCheckpoint(playerid)
{
	return 1;
}

public OnPlayerEnterRaceCheckpoint(playerid)
{
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	return 1;
}

public OnRconCommand(cmd[])
{
	return 1;
}

public OnPlayerRequestSpawn(playerid)
{
	return 1;
}

public OnObjectMoved(objectid)
{
	return 1;
}

public OnPlayerObjectMoved(playerid, objectid)
{
	return 1;
}

public OnPlayerPickUpPickup(playerid, pickupid)
{
	return 1;
}

public OnVehicleMod(playerid, vehicleid, componentid)
{
	return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
	return 1;
}

public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
	return 1;
}

public OnPlayerSelectedMenuRow(playerid, row)
{
	return 1;
}

public OnPlayerExitedMenu(playerid)
{
	return 1;
}

public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
	return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
	return 1;
}

public OnRconLoginAttempt(ip[], password[], success)
{
	return 1;
}

public OnPlayerUpdate(playerid)
{
	return 1;
}

public OnPlayerStreamIn(playerid, forplayerid)
{
	return 1;
}

public OnPlayerStreamOut(playerid, forplayerid)
{
	return 1;
}

public OnVehicleStreamIn(vehicleid, forplayerid)
{
	return 1;
}

public OnVehicleStreamOut(vehicleid, forplayerid)
{
	return 1;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(strlen(inputtext) >= 5 && strlen(inputtext) <= 20)
                {
                    new WPHash[129];
                    WP_Hash(WPHash, sizeof(WPHash), inputtext);
					new INI:playerFile = INI_Open(UserPath(playerid));
					INI_SetTag(playerFile, "statistics");
				    INI_WriteString(playerFile, "Password", WPHash);
				    INI_WriteInt(playerFile, "Admin", 0);
				    INI_WriteInt(playerFile, "Kills", 0);
				    INI_WriteInt(playerFile, "Deaths", 0);
				    INI_WriteInt(playerFile, "Money", 0);
				    INI_Close(playerFile);

                    format(dString, sizeof(dString), "UspjeÅ¡no ste se registrirali pod imenom "CWHITE"'%s' "CRED"i lozinkom "CWHITE"'%s'"CRED". Zahvaljujemo na registracij!", GetName(playerid), inputtext);
                    SendClientMessage(playerid, RED, dString);
                }
                else
                {
                    format(dString, sizeof(dString), ""CLBLUE"%s "CWHITE"upisali ste prekratku ili preveliku lozinku.\n\nVaÅ¡ lozinka mora sadržavati najmanje "CLBLUE"5 "CWHITE", a najviÅ¡e "CLBLUE"20 "CWHITE"znaka.", GetName(playerid));
                    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "X RolePlay - Register", dString, "Register", "Quit");
                }
            }
        }
        case DIALOG_LOGIN:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                new WPHash[129];
                WP_Hash(WPHash, sizeof(WPHash), inputtext);
				if(!strcmp(WPHash, PlayerData[playerid][Password], false))
				{
    			new ime[MAX_PLAYER_NAME];
			    GetPlayerName(playerid, ime, sizeof(ime));
				format(string,sizeof(string),"Users/%s.ini",ime);
				INI_ParseFile(string, "user_data_%s", .bExtra = true, .extra = playerid);
		    	}
                else
                {
                    format(dString, sizeof(dString), ""CLBLUE"%s "CWHITE"upisali ste pogreÅ¡nu lozinku.\nMolimo u prazno polje upiÅ¡ite ispravnu lozinku za pristup serveru.", GetName(playerid));
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "X RolePlay - Login", dString, "Login", "Quit");
                }
            }
        }
    }
	return 1;
}

public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
	return 1;
}

/* #FUNCTION */

function user_data(playerid, name[], value[])
{
    INI_String("Password", PlayerData[playerid][Password], 129);
    INI_Int("Admin", PlayerData[playerid][Admin]);
    INI_Int("Kills", PlayerData[playerid][Kills]);
    INI_Int("Deaths", PlayerData[playerid][Deaths]);
    INI_Int("Money", PlayerData[playerid][Money]);
    return 1;
}

/* #STOCK */

stock UserPath(playerid)
{
    new string[128], Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, sizeof(Name));
    format(string, sizeof(string), PATH, Name);
    return string;
}

stock GetName(playerid)
{
    new Name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME);
    return Name;
}

/*____________________________________________________________________________*/

rijesio sam usput ralph hvala na pomoci ali nije u tom bio problem @sabo javljas se bezveze