17.08.2015, 20:13
(
Последний раз редактировалось Luke_James; 17.08.2015 в 21:16.
)
The strings for Issued To, Issued By and Issue Date are not displaying and I can't understand why. My SQL is correct and they are saving absolutely fine when I use the /givelicense command...

This is the code that loads licenses...
This is the code that saves them
and this is the part of the /givelicense command that inserts the data into the columns

PHP код:
CMD:showlicense(playerid, params[])
{
static
userid;
if (sscanf(params, "u", userid))
return SendSyntaxMessage(playerid, "/showlicense [playerid/name]");
if (userid == INVALID_PLAYER_ID || !IsPlayerNearPlayer(playerid, userid, 5.0))
return SendErrorMessage(playerid, "That player is disconnected or not near you.");
SendClientMessageEx(userid, COLOR_GREY, "|_______________Vehicle Licenses_______________|");
if (Inventory_HasItem(playerid, "Driving License")) SendClientMessageEx(userid, COLOR_WHITE, "GVL-1 {33CC33}OBTAINED)");
else SendClientMessageEx(userid, COLOR_WHITE, "GVL-1 {AA3333}NOT OBTAINED");
SendClientMessageEx(userid, COLOR_GREY, "|_______________Firearms License _______________|");
if (Inventory_HasItem(playerid, "Weapon License"))
{
SendClientMessage(userid, COLOR_WHITE, "Firearms License - {33CC33}OBTAINED");
SendClientMessageEx(userid, COLOR_WHITE, "Issued To: %s", LicenseData[playerid][licenseOwner]);
SendClientMessageEx(userid, COLOR_WHITE, "Issued By: %s", LicenseData[playerid][licenseIssuer]);
SendClientMessageEx(userid, COLOR_WHITE, "Issue Date: %s", LicenseData[playerid][licenseDate]);
}
else if (!Inventory_HasItem(playerid, "Weapon License"))
{
SendClientMessage(userid, COLOR_WHITE, "Firearms License - {AA3333}NOT OBTAINED");
}
SendNearbyMessage(playerid, 30.0, COLOR_PURPLE, "%s takes out their licenses and shows them to %s.", ReturnName(playerid, 0), ReturnName(userid, 0));
return 1;
}
PHP код:
case THREAD_LOAD_LICENSES:
{
cache_get_data(rows, fields, g_iHandle);
for (new i = 0; i < rows && i < MAX_LICENSES; i ++) {
cache_get_field_content(i, "issueDate", LicenseData[extraid][i][licenseDate], g_iHandle, 128);
cache_get_field_content(i, "ownerID", LicenseData[extraid][i][licenseOwner], g_iHandle, 128);
cache_get_field_content(i, "issuerID", LicenseData[extraid][i][licenseIssuer], g_iHandle, 128);
LicenseData[extraid][i][licenseID] = cache_get_field_int(i, "licID");
}
}
PHP код:
SQL_SaveLicenses(playerid)
{
if (!PlayerData[playerid][pLogged])
return 0;
static
query[256];
format(query, sizeof(query), "UPDATE `licenses` SET `licID` = '%d', `ownerID` = '%s', `issuerID` = '%s', `issueDate` = '%s' WHERE `ID` = '%d'",
LicenseData[playerid][licenseID],
LicenseData[playerid][licenseOwner],
LicenseData[playerid][licenseIssuer],
LicenseData[playerid][licenseDate]
);
mysql_function_query(g_iHandle, query, false, "", "");
return 1;
}
PHP код:
static
query[248];
format(query, sizeof(query), "INSERT INTO `licenses` (`ownerID`, `issuerID`, `issueDate`) VALUES('%s', '%s', '%s')", ReturnName(userid), ReturnName(playerid), ReturnDate());
mysql_function_query(g_iHandle, query, false, "", "");