03.03.2017, 16:41
So when a player requests an application it saves the player's name and first question answer, After saving I go to the MySQL Applications and the other question answers haven't been set, Anyhelp?
Код:
public OnPlayerText(playerid, text[]) { if(GetPVarInt(playerid, "AppMade") == 0) { if(GetPVarInt(playerid, "Questions") == 1) { SendClientMessage(playerid, 0x00FF00FF, "Question 2: What does OOC and IC stand for?"); SetPVarInt(playerid, "Questions", 2); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "INSERT INTO `applications` (`Name`, `Question1`, `Accepted`)\ VALUES ('%e', '%e', 0)", PlayerInfo[playerid][Name], text); mysql_query(mysql, querylist); return 0; } if(GetPVarInt(playerid, "Questions") == 2) { SendClientMessage(playerid, 0x00FF00FF, "Question 3: What does PG mean and what is it?"); SetPVarInt(playerid, "Questions", 3); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question2` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]); mysql_query(mysql, querylist); return 0; } if(GetPVarInt(playerid, "Questions") == 3) { SendClientMessage(playerid, 0x00FF00FF, "Question 4: What is Revenge Killing?"); SetPVarInt(playerid, "Questions", 4); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question3` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]); mysql_query(mysql, querylist); return 0; } if(GetPVarInt(playerid, "Questions") == 4) { SendClientMessage(playerid, 0x00FF00FF, "Question 5: Give an example of a /do command?"); SetPVarInt(playerid, "Questions", 5); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question4` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]); mysql_query(mysql, querylist); return 0; } if(GetPVarInt(playerid, "Questions") == 5) { SendClientMessage(playerid, 0x00FF00FF, "Question 6: What does PG mean and what is it?"); SetPVarInt(playerid, "Questions", 6); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question5` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]); mysql_query(mysql, querylist); return 0; } if(GetPVarInt(playerid, "Questions") == 6) { new str[128]; new pName[24]; SendClientMessage(playerid, 0x00FF00FF, "Server: Thank you for taking the quiz, A member of staff will review it shortly."); SetPVarInt(playerid, "Questions", 0); GetPlayerName(playerid, pName, 24); SetPVarInt(playerid, "AppMade", 1); SetPVarInt(playerid, "AppPassed", 0); new querylist[256]; mysql_format(mysql, querylist, sizeof(querylist), "UPDATE `applications` SET `Question6` = %e WHERE `Name` = '%e'" , text, PlayerInfo[playerid][Name]); mysql_query(mysql, querylist); LoadApplications(); GiveNameSpace(ApplicationInfo[playerid][Name]); format(str, sizeof(str), "Server: New application to be reviewed posted by %s (%d) (/applications).", pName, playerid); SendAdminMessage(COLOR_ORANGE, str); return 0; } } return 1; }