SA-MP Forums

SA-MP Forums (https://forum.sa-mp.com/index.php)
-   Scripting Help (https://forum.sa-mp.com/forumdisplay.php?f=12)
-   -   MySQL - Check Register (https://forum.sa-mp.com/showthread.php?t=656292)

BrainDamaged 12/07/2018 11:02 AM

MySQL - Check Register
 
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 ?


Code:

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 11:26 AM

Re: MySQL - Check Register
 
I just checked the code from Gammix's gamemode and resetting value for e_USER_SQLID is -1. Therefore:
pawn Code:
if (eUser[playerid][e_USER_SQLID] != -1)

BrainDamaged 12/07/2018 11:38 AM

Re: MySQL - Check Register
 
I changed the problem like this

Code:

if (!GetPVarInt(playerid, "LoggedIn"))
is it true ?

JasonRiggs 12/07/2018 03:11 PM

Re: MySQL - Check Register
 
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 09:13 PM

Re: MySQL - Check Register
 
Quote:

Originally Posted by JasonRiggs (Post 4036141)
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


All times are GMT. The time now is 03:54 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.