#include <a_samp> #include <ZCMD> #include <YSI\y_ini> #include <sscanf2> #include <dini> #include <streamer> #include <a_angles> #include <sscanf2> #include <foreach>
#define DIALOG_REGISTER 1 #define DIALOG_LOGIN 2 #define DIALOG_SUCCESS_1 3 #define DIALOG_SUCCESS_2 4 #define PATH "/Users/%s.ini"
if(fexist(UserPath(playerid))) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit"); } else { ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,""COL_WHITE"Registeration",""COL_WHITE"Type your password below to register a new account.","Register","Quit"); } return 1; }
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,"Kills",PlayerInfo[playerid][pKills]); INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]); INI_WriteInt(File,"Level",PlayerInfo[playerid][pLevel]); INI_WriteInt(File,"VIP",PlayerInfo[playerid][pVIP]); INI_WriteInt(File,"FightStyle",PlayerInfo[playerid][pFightStyle]); INI_WriteInt(File,"Warnings",PlayerInfo[playerid][pWarnings]); INI_WriteInt(File,"Hours", PlayerInfo[playerid][pPlayingTime]); INI_WriteInt(File,"Kicks", PlayerInfo[playerid][pKicks]); INI_Close(File); return 1; }
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,"Kills",0); INI_WriteInt(File,"Deaths",0); INI_WriteInt(File,"Level",0); INI_WriteInt(File,"VIP",0); INI_WriteInt(File,"FightStyle",0); INI_WriteInt(File,"Warnings",0); INI_WriteInt(File,"Hours",0); INI_WriteInt(File,"Kicks",0); INI_Close(File); SetSpawnInfo(playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"You're account was converted, please relog","Ok",""); TogglePlayerControllable(playerid, false); } } 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]); if(PlayerInfo[playerid][pAdmin] == 1 || PlayerInfo[playerid][pAdmin] == 2 || PlayerInfo[playerid][pAdmin] == 3 || PlayerInfo[playerid][pAdmin] == 4 || PlayerInfo[playerid][pAdmin] == 5) { SendClientMessage(playerid, COLOR_GREEN, "AdminMOTD: Stay connected and use your commands wisely"); } } 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"); } 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; }
wtf SERIOUSLY?
WHY YOU BUMPING THREAD WHICH WAS CREATED 1 YEAR AGO. |