SA-MP Forums Archive
MYSQL registration - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MYSQL registration (/showthread.php?tid=628741)



MYSQL registration - sscarface - 14.02.2017

Код:
public OnAccountRegister(playerid)
{
    IsLoggedIn[playerid] = 1;
    pData[playerid][pID] = cache_insert_id(); //loads the ID of the player in the variable once they registered.
    printf("New account registered. ID: %d", pData[playerid][pID]); //just for debugging.
    SetPlayerCash(playerid, 50000);
    pData[playerid][pRegularPlayer] = cache_get_field_content_int(0, "RegularPlayer");
    GivePlayerMoney(playerid, 50000);
    SetPlayerScore(playerid, 0);
    SetPlayerWantedLevelEx(playerid, 0);
    TogglePlayerSpectating(playerid, 0);
    TextDrawShowForPlayer(playerid, RULEBOX);
	TextDrawShowForPlayer(playerid, rule1);
	TextDrawShowForPlayer(playerid, rule2);
    SendClientMessage(playerid, GREEN, "You have successfully registered your account");
    SendClientMessage(playerid, COLOR_CYAN, "You are starting a new life! Type /help, /commands for help");
    return 1;
}
Код:
[08:16:52] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - starting query execution
[08:16:52] [ERROR] CMySQLQuery::Execute[OnAccountRegister] - (error #1364) Field 'RegularPlayer' doesn't have a default value
[08:16:52] [DEBUG] CMySQLQuery::Execute[OnAccountRegister] - error will be triggered in OnQueryError
Thank you.


Re: MYSQL registration - Rdx - 14.02.2017

Set default value in DB for field RegularPlayer.


Re: MYSQL registration - sscarface - 14.02.2017

Do you mean on local host? Or in script? . I know I have to do something like that because that's what it says but could you please explain it little bit more? Thanks


Re: MYSQL registration - Rdx - 14.02.2017

PhpMyAdmin


Re: MYSQL registration - sscarface - 14.02.2017

Thanks I will try.


Re: MYSQL registration - sKenzi1996 - 14.02.2017

Did it work?


Re: MYSQL registration - sscarface - 14.02.2017

Yes and thank you RDX for responding me so quick.