PDA

View Full Version : MYSQL registration


sscarface
14/02/2017, 12:25 PM
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.

Rdx
14/02/2017, 12:28 PM
Set default value in DB for field RegularPlayer.

sscarface
14/02/2017, 12:51 PM
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

Rdx
14/02/2017, 01:00 PM
PhpMyAdmin

sscarface
14/02/2017, 01:10 PM
Thanks I will try.

sKenzi1996
14/02/2017, 01:16 PM
Did it work?

sscarface
14/02/2017, 01:40 PM
Yes and thank you RDX for responding me so quick.