25.06.2014, 08:18
Problem : The color code saves correctly, but it does not set the color.
Objective : Set the color which I saved to the database.
OnPlayerConnect
Objective : Set the color which I saved to the database.
OnPlayerConnect
pawn Код:
format(Query2,sizeof(Query2),"SELECT * FROM `users` WHERE `Name` = '%s'", GetName(playerid));
mysql_function_query(cHandle, Query2, true, "CheckStats", "d", playerid);
pawn Код:
public CheckStats(playerid, name[])
{
new rows, fields;
cache_get_data (rows, fields, cHandle);
if(rows)
{
new mHolder[128], color;
cache_get_field_content(0, "Color", mHolder, cHandle);
SetPlayerColor(playerid, color);
}
return 1;
}
pawn Код:
// example of colorcode = 0x00CC00FF
format(Query1,sizeof(Query1),"UPDATE `users` SET `Color` = '%s' WHERE `Name` = '%s'", colorcode, GetName(playerid));
mysql_function_query(cHandle, Query1, false, "", "d", playerid);