PDA

View Full Version : MySQL - Check Register


BrainDamaged
12/07/2018, 10:02 AM
Hi, if you try to use the registered players command, you will get an error saying that you are not registered. How can i solve the problem ?


CMD:changeques(playerid, params[])
{
if (eUser[playerid][e_USER_SQLID] != 1)
{
SendClientMessage(playerid, COLOR_TOMATO, "Only registered users can use this command.");
return 1;
}

new list[2 + (sizeof(SECURITY_QUESTIONS) * MAX_SECURITY_QUESTION_SIZE)];
for (new i; i < sizeof(SECURITY_QUESTIONS); i++)
{
strcat(list, SECURITY_QUESTIONS[i]);
strcat(list, "\n");
}
ShowPlayerDialog(playerid, CHANGE_SEC_QUESTION, DIALOG_STYLE_LIST, "Change account security question... [Step: 1/2]", list, "Continue", "Cancel");
SendClientMessage(playerid, COLOR_WHITE, "[Step: 1/2] Select a security question. This will help you retrieve your password in case you forget it any time soon!");
PlayerPlaySound(playerid, 1054, 0.0, 0.0, 0.0);
return 1;
}

Calisthenics
12/07/2018, 10:26 AM
I just checked the code from Gammix's gamemode and resetting value for e_USER_SQLID is -1. Therefore:

if (eUser[playerid][e_USER_SQLID] != -1)

BrainDamaged
12/07/2018, 10:38 AM
I changed the problem like this

if (!GetPVarInt(playerid, "LoggedIn"))

is it true ?

JasonRiggs
12/07/2018, 02:11 PM
This checks if the player is logged in tho.. (If you already set a variable integer of logging in to the player to 1) I guess you need to know if the player is registered or no, By checking if his SQLID is a valid row id in the accounts table.. valid ID = not equal -1..

BrainDamaged
12/07/2018, 08:13 PM
This checks if the player is logged in tho.. (If you already set a variable integer of logging in to the player to 1) I guess you need to know if the player is registered or no, By checking if his SQLID is a valid row id in the accounts table.. valid ID = not equal -1..


Thank you for the information