Jump to content
  • 0

pomoc Register Ukladanie


Macko

Dotaz

Dobrý Večer,

mám registraciu cez y_ini a ulozi sa mi čo som nahral na servery a ked sa pozrem do SF tak všetko mam na 0

 

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])

{

switch( dialogid )

{

case DIALOG_REGISTER:

{

if (!response) return Kick(playerid);

if(response)

{

if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");

new INI:File = INI_Open(UserPath(playerid));

INI_SetTag(File,"data");

INI_WriteInt(File,"Password",udb_hash(inputtext));

INI_WriteInt(File,"Cash",0);

INI_WriteInt(File,"Admin",0);

INI_WriteInt(File,"Score",0);

INI_WriteInt(File,"Kills",0);

INI_WriteInt(File,"Deaths",0);

INI_WriteInt(File,"Dny",0);

INI_WriteInt(File,"Minut",0);

INI_WriteInt(File,"Hodin",0);

INI_WriteInt(File,"Sekund",0);

INI_WriteInt(File,"Obcanka",0);

INI_Close(File);

 

SetSpawnInfo(playerid, 0, 0, 1685.8154,-2333.9470,-2.6797,1.1942,46, 1, 16, 1, 24, 7);

SpawnPlayer(playerid);

ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Great! Your Y_INI system works perfectly. Relog to save your stats!","Ok","");

}

}

 

case DIALOG_LOGIN:

{

if ( !response ) return Kick ( playerid );

if( response )

{

if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])

{

INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);

ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You have successfully logged in!","Ok","");

}

else

{

ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_RED"You have entered an incorrect password.\n"COL_WHITE"Type your password below to login.","Login","Quit");

}

new string[256];

format(string,256,"[ Nahrané Dny: %d || Hodiny: %d || Minuty: %d || Sekundy: %d]",PlayerInfo[playerid][pDny],PlayerInfo[playerid][pHodiny],PlayerInfo[playerid][pMinuty],PlayerInfo[playerid][pSekundy]);

SendClientMessage(playerid, COLOR_RED, string);

return 1;

}

}

}

return 1;

}

 

Link to comment
Share on other sites

5 odpovědí na tuto otázku

Recommended Posts

  • 0

INI_WriteInt(File,"Cash",0);
INI_WriteInt(File,"Admin",0);
INI_WriteInt(File,"Score",0);
INI_WriteInt(File,"Kills",0);
INI_WriteInt(File,"Deaths",0);
INI_WriteInt(File,"Dny",0);
INI_WriteInt(File,"Minut",0);
INI_WriteInt(File,"Hodin",0);
INI_WriteInt(File,"Sekund",0);
INI_WriteInt(File,"Obcanka",0);

 

Proč asi?

 

 

 

nemáš ukládání, nebo jsi ho sem nedal.

 

 

Link to comment
Share on other sites

  • 0

public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",PlayerInfo[playerid][pPass]);
INI_Int("Cash",PlayerInfo[playerid][pCash]);
INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
INI_Int("Kills",PlayerInfo[playerid][pKills]);
INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
INI_Int("Dny",PlayerInfo[playerid][pDny]);
INI_Int("Hodin",PlayerInfo[playerid][pHodiny]);
INI_Int("Minut",PlayerInfo[playerid][pMinuty]);
INI_Int("Sekund",PlayerInfo[playerid][pSekundy]);
INI_Int("Obcanka",PlayerInfo[playerid][pobcanka]);
return 1;
}

toto mám

Link to comment
Share on other sites

  • 0
#define PATH "%s.ini"
public OnPlayerDisconnect(playerid, reason)
{
   new INI:File = INI_Open(UserPath(playerid));
   INI_SetTag(File,"data");
   INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
   INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
   INI_WriteInt(File,"Score",PlayerInfo[playerid][pScore]);
   INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
   INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
   INI_WriteInt(File,"Dny",PlayerInfo[playerid][pDny]);
   INI_WriteInt(File,"Hodin",PlayerInfo[playerid][pHodiny]);
   INI_WriteInt(File,"Minut",PlayerInfo[playerid][pMinuty]);
   INI_WriteInt(File,"Sekund",PlayerInfo[playerid][pSekundy]);
   INI_Close(File);
   return 1;
   }

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...