13.06.2015, 01:30
So I have made a few dialogs that will show up if a player tries to avoid them upon register now even if I complete them after checking if it is 0 they keep popping up and I have made sure everything is being saved correctly.
this is my code
this is my code
pawn Код:
public OnPlayerConnect(playerid)
{
for( new i; i < _: USER_DATA; ++i ) pInfo[ playerid ][ USER_DATA: i ] = 0;
TogglePlayerSpectating(playerid, true);
GetPlayerName(playerid, pInfo[playerid][USER_NAME], MAX_PLAYER_NAME);
new Query[256], DBResult:Result;
format(Query, sizeof(Query), "SELECT password FROM users WHERE username = '%s' LIMIT 0,1", DB_Escape(pInfo[playerid][USER_NAME]));
Result = db_query(Database, Query);
if(db_num_rows(Result))
{
if(pInfo[playerid][USER_PASSEDQUIZ] == 0)
{
ShowPlayerDialog(playerid, quizinfo, DIALOG_STYLE_MSGBOX, "Quiz","Before you start playing please take a quick roleplay quit\nThe quiz is based off 10 questions if you get 3 questions wrong you'll have to re take the quiz.", "Okay", "Quit");
return 1;
}
if(pInfo[playerid][USER_BIRTHPLACE] == 0)
{
ShowPlayerDialog(playerid, selectbirthplace, DIALOG_STYLE_INPUT, "Where is your character from?", "Write the location of the place your character was born below.", "Sumbit", "");
return 1;
}
if(pInfo[playerid][USER_AGE] == 0)
{
ShowPlayerDialog(playerid, selectage, DIALOG_STYLE_INPUT, "Select an age", "Select the age of your character you can choose 1 to 100.", "Sumbit", "");
return 1;
}
if(pInfo[playerid][USER_CULTURE] == 0)
{
ShowPlayerDialog(playerid, selectculture, DIALOG_STYLE_INPUT, "What is your character's culture?", "Write the culture that your character will be roleplaying (Ex.American).", "Sumbit", "");
return 1;
}
if(pInfo[playerid][USER_RACE] == 0)
{
ShowPlayerDialog(playerid, selectrace, DIALOG_STYLE_LIST, "Select your character's race", "White\nHispanic\nBlack\nAsian", "Select", "");
return 1;
}
if(pInfo[playerid][USER_SKIN] == 0)
{
ShowPlayerDialog(playerid, selectskin, DIALOG_STYLE_INPUT, "Select your skin!", "Write the ID of the skin you desire.", "Sumbit", "");
return 1;
}
db_get_field_assoc(Result, "password", pInfo[playerid][USER_PASSWORD], 129);
ShowPlayerDialog(playerid, dlogin, DIALOG_STYLE_PASSWORD, "Login", "Write your password to login.", "Login", "Quit");
}
else ShowPlayerDialog(playerid, dregister, DIALOG_STYLE_PASSWORD, "Register", "Write your password to register", "Register", "Quit");
db_free_result(Result);
return 1;
}