20.06.2016, 20:26
(
Последний раз редактировалось JXF; 20.06.2016 в 21:44.
)
Hello. I tried to add ******' register/login system to my gamemode. It somewhat worked fine, apart from the accounts saving after a restart. Also, I have multiple scripts in my OnDialogReponse callback, which sort of mix together.
here is the callback:
FROM DIALOG_VIP_WEAPONS it's a separate script.
It also spawns me strangely.
Album
EDIT:
I also get these warnings in my server_log:
here is the callback:
Код:
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, "{FFFFFF}Registering...","{FF0000}You have entered an invalid password.\n""{FFFFFF}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_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,"{00FF15}Success!","{00FF15}Great! Your account works perfectly!","Ok", " "); } } case DIALOG_LOGIN: { if ( !response ) return Kick ( playerid ); if( response ) { if(udb_hash(inputtext) == Player[playerid][pPass]) { INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid); GivePlayerMoney(playerid, Player[playerid][pCash]); ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"{FFFFFF}Success!","{FFFFFF}You have successfully logged in!","Ok",""); } else { ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"{FFFFFF}Login","{FF0000}You have entered an incorrect password.\n""{FFFFFF}Type your password below to login.","Login","Quit"); } return 1; } } } if(dialogid == DIALOG_VIP_WEAPONS) { if(response) { if(listitem == 0) { if(GetPlayerMoney(playerid) < 35000) { SCM(pid, -1, "You don't have enough cash for that!"); return 1; } else { GivePlayerWeapon(playerid, 31, 250); GivePlayerMoney(playerid, -35000); SCM(pid, -1, "{FFD83D} You have bought an {FF0000}M4 {FFD83D}for {09FF00}$35.000!"); } } if(listitem == 1) { if(GetPlayerMoney(playerid) < 20000) { SCM(pid, -1, "You don't have enough cash for that!"); return 1; } else { GivePlayerWeapon(playerid, 24, 100); GivePlayerMoney(playerid, -20000); SCM(pid, -1, "{FFD83D} You have bought a {FF0000}Deagle {FFD83D}for {09FF00}$20.000!"); } } if(listitem == 2) { if(GetPlayerMoney(playerid) < 15000) { SCM(pid, -1, "You don't have enough cash for that!"); return 1; } else { GivePlayerWeapon(playerid, 29, 200); GivePlayerMoney(playerid, -15000); SCM(pid, -1, "{FFD83D} You have bought an {FF0000}MP5 {FFD83D}for {09FF00}$15.000!"); } } if(listitem == 3) { if(GetPlayerMoney(playerid) < 40000) { SCM(pid, -1, "You don't have enough cash for that!"); return 1; } else { GivePlayerWeapon(playerid, 30, 250); GivePlayerMoney(playerid, -40000); SCM(pid, -1, "{FFD83D} You have bought an {FF0000}AK47 {FFD83D}for {09FF00}$40.000!"); } } } } switch(dialogid) { case DIALOG_ID_VIP_COLORS: { if(response) { new color; switch(listitem) { // Listitem ID starts from 0. There are 9 items. case 0: color = 0xF30DFF00; case 1: color = 0xB10AFF00; case 2: color = 0x7B7DED00; case 3: color = 0x00FFAA00; case 4: color = 0xFF7A2100; case 5: color = 0x75757500; case 6: color = 0xFF858500; case 7: color = 0xF6FF0000; case 8: color = 0xA34D4D00; } SendClientMessage(playerid, color, " Your colour has been changed."); SetPlayerColor(playerid, color); } } } return 1; }
It also spawns me strangely.
Album
EDIT:
I also get these warnings in my server_log:
Код:
[21:21:35] password = "" (string) [21:21:35] [0.3.7]JXF's server (V1.0), has been loaded successfully. [21:21:35] Number of vehicle models: 0 [21:21:39] *** YSI Warning: INI_Open could not find or create file /Users/JXF.ini [21:34:44] *** YSI Warning: INI_Open could not find or create file /Users/JXF.ini [21:34:44] [part] JXF has left the server (0:1)