28.01.2014, 00:17
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:
Now for the saving of the variable, savePlayerData(const playerid), add somewhere in to the format queries, preferably in this one:
Add the following code inside the format, after '%s, ' (replace where appropriate):
And add to the format after 'saveQuery,' (replace where appropriate)
Now your variable (if it's an integer) should save when a player logs off and load when a player logs back in.
pawn Код:
mysql_get_field("playerLicense", result); // Replace where appropriate.
playerVariables[extraid][pCarLicense] = strval(result); // Replace where appropriate.
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]);
pawn Код:
playerLicense = %d,
pawn Код:
playerVariables[playerid][pCarLicense],