10.01.2016, 13:27
[spoiler]
[/spoiler]
This is the entire code fr my registration dialogs. I am tryingt o make it save when a player registers, but it wont. Please ignore the INI stuff above it, I leave it there for icnase I want to return. These are the errors in the MYSQL log:
Please can someone help, Iwill rep+ you.
Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[]) { switch( dialogid ) { case DIALOG_REGISTER: { if (!response) return Kick(playerid); if(response) { if(strlen(inputtext) < 4 || strlen(inputtext) > 50) return SendClientMessage(playerid, WARNRED, "Please choose a password between FOUR (4) and FIFTY (50) characters."); if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Registering...",""COLOR_RED"You have entered an invalid password.\n"COLOR_WHITE"Type your password below to register a new account.","Register","Quit"); new INI:File = INI_Open(UserPath(playerid)); PlayerInfo[playerid][pLogged] = 1; ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COLOR_WHITE"Success!",""COLOR_GREEN"You are now registered!","Ok",""); INI_SetTag(File,"data"); INI_WriteInt(File,"UserID",0); INI_WriteInt(File,"Password",udb_hash(inputtext)); INI_WriteInt(File,"Cash",0); INI_WriteInt(File,"Admin",0); INI_WriteInt(File,"Moderator",0); INI_WriteInt(File,"Helper",0);// INI_WriteInt(File,"Gender",0); INI_WriteInt(File,"Health",0); INI_WriteInt(File,"Age",0); INI_WriteInt(File,"Muted",0); INI_WriteInt(File,"Skin",1); INI_WriteInt(File,"Level",0); INI_WriteInt(File,"Faction",0); INI_WriteInt(File,"Rank",0); INI_WriteInt(File,"AwayStatus",0); INI_WriteInt(File,"SubmittedHelp",0); INI_WriteInt(File,"Country",strlen(inputtext)); INI_WriteInt(File,"Test",0); INI_WriteInt(File,"PhoneN",0); INI_WriteInt(File,"Vehicle",0); INI_WriteInt(File,"Logged",0); INI_WriteInt(File,"InHosp",0); PlayerInfo[playerid][pPass] = udb_hash(inputtext); new query[1500]; { format(query,sizeof(query),"INSERT INTO `Accounts` (`Username`,`pPass`) VALUES ('%s','%s')",GetName(playerid),PlayerInfo[playerid][pPass]); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", ""); } INI_Close(File); printf("%s (%d)'s has registered!", RPName(playerid), playerid); ShowPlayerDialog(playerid, DIALOG_AGE, DIALOG_STYLE_INPUT, ""COLOR_WHITE"Age registration",""""COLOR_WHITE"Please choose an age between 18 and 75.","Select age",""); } } case DIALOG_AGE: { if (!response) return Kick(playerid); if(response) { new string[128]; if(PlayerInfo[playerid][pAge] >= 1) { PlayerInfo[playerid][pAge] = strval(inputtext); format(string, sizeof(string), "So you are %d years old.", PlayerInfo[playerid][pAge]); SendClientMessage(playerid, WHITE, string); new query[1500]; { format(query, sizeof(query), "UPDATE `Accounts` (`Age`) VALUES (`%s`) WHERE `Username` = '%s'",PlayerInfo[playerid][pAge], GetName(playerid)); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", ""); } } ShowPlayerDialog(playerid, 7002, DIALOG_STYLE_LIST, "Registration -> Gender", "Male\nFemale", "Select", "Quit"); } } case 7002: { switch(listitem) { case 0: { SendClientMessage(playerid, WHITE, "So you are a Male."); ShowPlayerDialog(playerid, 7003, DIALOG_STYLE_INPUT, "Registration -> Country", "{FFFFFF}Enter the country your Characters is comming from.", "Enter", ""); new rand = random(sizeof(RandomMaleSkins)); PlayerInfo[playerid][pSkin] = RandomMaleSkins[rand]; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); new query[1500]; { PlayerInfo[playerid][pGender] = 1; format(query, sizeof(query), "UPDATE `Accounts` (`Gender`) VALUES(`%s`) WHERE `Username` = '%s'",PlayerInfo[playerid][pGender], GetName(playerid)); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", ""); } } case 1: { new rand = random(sizeof(RandomFemaleSkins)); PlayerInfo[playerid][pSkin] = RandomFemaleSkins[rand][0]; SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]); SendClientMessage(playerid, WHITE, "So you are a Female."); PlayerInfo[playerid][pGender] = 2; ShowPlayerDialog(playerid, 7003, DIALOG_STYLE_INPUT, "Registration -> Country", "{FFFFFF}Enter the country your Characters is comming from.", "Enter", ""); new query[1500]; { format(query, sizeof(query), "UPDATE `Accounts` (`Gender`) VALUES(`%s`) WHERE `Username` = '%s'",PlayerInfo[playerid][pGender], GetName(playerid)); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", ""); } } } } case 7003: { new string[128]; format(PlayerInfo[playerid][pCountry], 255, inputtext); format(string, sizeof(string), "So you are comming from %s.", inputtext); PlayerInfo[playerid][pCountry] = strlen(inputtext); SendClientMessage(playerid, WHITE, string); if(PlayerInfo[playerid][pGender] >= 1) { SetSpawnInfo(playerid, 0, PlayerInfo[playerid][pSkin], 1503.277343, -1728.304809, 27.541816, 0, 0, 0, 0, 0, 0, 0); SpawnPlayer(playerid); PlayerInfo[playerid][pLogged] = 1; SetTimerEx("CameraTutorial1", 10, false, "d", playerid); TogglePlayerControllable(playerid, false); } new query[1500]; { format(query, sizeof(query), "UPDATE `Accounts` ('Country') VALUES('%d') WHERE `Username` = '%s'",PlayerInfo[playerid][pCountry], GetName(playerid)); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", ""); } }
Код:
new query[2000]; format(query, sizeof(query),"UPDATE `Accounts` SET `pAdmin` = %d, `pModerator` = %d, `pHelper` = %d, `pSkin` = %d, `pHealth` = %f,`pFaction` = %d,`pRank` = %d,`pRankName` = %s,`pJob` = %d, `pLevel` = %d, `pCountry` = %s, `SubmittedHelp` = %d, `HelpMessage` = %s, `pMuted` = %d, `pTest` = %d, `pPhoneN` = %d, `XPos` = %d, `ZPos` = %d, `YPos` = %d, `pCash` = %d, `pBonus` = %d, `AwayStatus` = %d, `pInHosp` = %d, `RentingVehicle` = %d WHERE `Username` = '%s'", PlayerInfo[playerid][pAdmin], PlayerInfo[playerid][pModerator], PlayerInfo[playerid][pHelper], GetPlayerSkin(playerid), PlayerInfo[playerid][pFaction], PlayerInfo[playerid][pRank], PlayerInfo[playerid][pRankName], PlayerInfo[playerid][pJob], PlayerInfo[playerid][pLevel], PlayerInfo[playerid][pCountry], PlayerInfo[playerid][SubmittedHelp], PlayerInfo[playerid][HelpMessage], PlayerInfo[playerid][pMuted], PlayerInfo[playerid][pTest] = 1, PlayerInfo[playerid][pPhoneN], PlayerInfo[playerid][XPos], PlayerInfo[playerid][YPos], PlayerInfo[playerid][ZPos], PlayerInfo[playerid][pCash], PlayerInfo[playerid][pBonus], PlayerInfo[playerid][AwayStatus] = 1, PlayerInfo[playerid][pInHosp] = 0, PlayerInfo[playerid][RentingVehicle] = 0, GetName(playerid)); mysql_function_query(g_connectionHandle, query, false, "DefaultCallback", "");
Код:
[14:14:43] Passing query UPDATE `Accounts` SET `pAdmin` = 0, `pModerator` = 0, `pHelper` = 0, `pSkin` = 1, `pHealth` = 0.000000,`pFaction` = 0,`pRank` = 0,`pRankName` = ,`pJob` = 0, `pLevel` = 56, `pCountry` = , `SubmittedHelp` = 0, `HelpMessage` = , `pMuted` = 1, `pTest` = 0, `pPhoneN` = -989728301, `XPos` = 1161174064, `ZPos` = 1168009377, `YPos` = 0, `pCash` = 0, `pBonus` = 1, `AwayStatus` = 0, `pInHosp` = 0, `RentingVehicle` = 116 WHERE `Username` = '' | [14:14:43] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError() [14:14:43] OnQueryError() - Called. [14:15:44] >> mysql_query_callback( Connection handle: 1 ) [14:15:44] Passing query INSERT INTO `Accounts` (`Username`,`pPass`) VALUES ('testing_test','‹') | [14:15:44] ProcessQueryThread(DefaultCallback) - Query was successful. (INSERT INTO `Accounts` (`Username`,`pPass`) VALUES ('testing_test','‹')) [14:15:44] CMySQLHandler::ProcessQueryThread() - Data is getting passed to ->ProcessTick() [14:15:44] DefaultCallback() - Threaded function called. [14:15:46] >> mysql_query_callback( Connection handle: 1 ) [14:15:46] Passing query INSERT INTO `Accounts` (`Gender`) VALUES(``) WHERE `Username` = 'testing_test' | [14:15:46] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError() [14:15:46] OnQueryError() - Called. [14:15:48] >> mysql_query_callback( Connection handle: 1 ) [14:15:48] Passing query INSERT INTO `Accounts` ('Country') VALUES('iami') WHERE `Username` = 'testing_test' | [14:15:48] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError() [14:15:48] OnQueryError() - Called. [14:19:09] >> mysql_query_callback( Connection handle: 1 ) [14:19:09] Passing query UPDATE `Accounts` SET `pAdmin` = 0, `pModerator` = 0, `pHelper` = 0, `pSkin` = 21, `pHealth` = 0.000000,`pFaction` = 0,`pRank` = 0,`pRankName` = ,`pJob` = 0, `pLevel` = 5, `pCountry` = , `SubmittedHelp` = 0, `HelpMessage` = , `pMuted` = 1, `pTest` = 0, `pPhoneN` = 1147324878, `XPos` = -992466733, `ZPos` = 1085242186, `YPos` = 0, `pCash` = 0, `pBonus` = 1, `AwayStatus` = 0, `pInHosp` = 0, `RentingVehicle` = 116 WHERE `Username` = '' | [14:19:09] CMySQLHandler::ProcessQueryThread() - Error will be triggered to OnQueryError() [14:19:09] OnQueryError() - Called.
Please can someone help, Iwill rep+ you.