29.03.2017, 19:26
PHP код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
INI_Int("Password",pInfo[playerid][Pass]);
INI_Int("Cash",pInfo[playerid][Cash]);
INI_Int("Level",pInfo[playerid][Admin]);
INI_Int("Kills",pInfo[playerid][Kills]);
INI_Int("Deaths",pInfo[playerid][Deaths]);
INI_Int("Score", pInfo[playerid][Score]);
INI_Int("Banned", pInfo[playerid][Banned]);
INI_Int("VIP", pInfo[playerid][VIP]);
INI_Int("VIPDay", pInfo[playerid][VIPDay]);
INI_Int("VIPMonth", pInfo[playerid][VIPMonth]);
INI_Int("VIPHour", pInfo[playerid][VIPHour]);
INI_Int("VIPTemp", pInfo[playerid][VIPTemp]);
INI_Int("Hours",pInfo[playerid][Hours]);
INI_Int("Minutes",pInfo[playerid][Minutes]);
INI_Int("pMuted",pInfo[playerid][pMuted]);
return 1;
}
PHP код:
switch( dialogid )
{
case DIALOG_REGISTER:
{
if (!response) return Kick(playerid);
if(response)
{
new pIP[16],year,month,day,hour,mins,sec,string[40],str[60];
getdate(year, month, day);
gettime(hour,mins,sec);
format(string, 40,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
format(str, 60,"%d/%d/%d at %d:%d:%d", day,month,year,hour,mins,sec);
GetPlayerIp(playerid,pIP,16);
if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registration Process Error",""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,"Hours",0);
INI_WriteInt(File,"Minutes",0);
INI_WriteString(File, "RegisteredOn", string);
INI_WriteString(File, "RegisteredIP", pIP);
INI_WriteString(File, "LastLoggedIP", pIP);
INI_Close(File);
pInfo[playerid][Hours] =0;
pInfo[playerid][Minutes] =0;
Logged[playerid] = 1;
SetPlayerPos(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraLookAt(playerid,1918.1643,1175.7311,18.2846);
SetPlayerCameraPos(playerid,1908.1575,1175.7079,18.2846);
SetPlayerFacingAngle(playerid,91.2061);
SetTimerEx("pTime", 1000, true, "i", playerid);
ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"Success!",""COL_GREEN"Youv'e successfully registered this account in our Database","Ok","");
format(astring, 125, "Your Username has been created in our Database | UserName: %s | Password: %s", GetName(playerid), inputtext);
return SendClientMessage(playerid,green,astring);
}
}