SA-MP Forums Archive
Question MySQL - 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: Question MySQL (/showthread.php?tid=490740)



Question MySQL - BuggedPlayer - 27.01.2014

Hi sa-mp.com! I have a question. I am newbie in MySQL, but i want to learn. I have Vortex Roleplay GAMEMODE and i didn't know how to add a new field in accounts (pCarLicence is the field). Please help me.


Re: Question MySQL - BuggedPlayer - 27.01.2014

bump..


Re: Question MySQL - Calgon - 28.01.2014

Add it in to the player array, reset it in the player variable reset function, add it to the table using a database admin tool (such as phpMyAdmin), CTRL+F for 'THREAD_CHECK_CREDENTIALS' and add somewhere in the code sequence:

pawn Код:
mysql_get_field("playerLicense", result); // Replace where appropriate.
playerVariables[extraid][pCarLicense] = strval(result); // Replace where appropriate.
Now for the saving of the variable, savePlayerData(const playerid), add somewhere in to the format queries, preferably in this one:

pawn Код:
format(saveQuery, sizeof(saveQuery), "%s, playerCarTrunk1 = '%d', playerCarTrunk2 = '%d', playerPhoneCredit = '%d', playerWalkieTalkie = '%d'", saveQuery, playerVariables[playerid][pCarTrunk][0], playerVariables[playerid][pCarTrunk][1], playerVariables[playerid][pPhoneCredit], playerVariables[playerid][pWalkieTalkie]);
Add the following code inside the format, after '%s, ' (replace where appropriate):
pawn Код:
playerLicense = %d,
And add to the format after 'saveQuery,' (replace where appropriate)
pawn Код:
playerVariables[playerid][pCarLicense],
Now your variable (if it's an integer) should save when a player logs off and load when a player logs back in.


Re: Question MySQL - BuggedPlayer - 28.01.2014

How to add in database?


Re: Question MySQL - BuggedPlayer - 28.01.2014

Somebody know?