21.01.2015, 20:20
Hey!
I was trying to make a car color changing command. It does change the color, but it wont save the color values in database". So here is the code:
Heres how my database looks:
http://prntscr.com/5vd34k
And heres the table Cars settings:
http://prntscr.com/5vd3kf
Also, this is how the Table_Cars define looks:
If theres more information necessary please let me know.
I was trying to make a car color changing command. It does change the color, but it wont save the color values in database". So here is the code:
PHP код:
CMD:vcolor(playerid, params[])
{
if(GetPlayerState(playerid) != 2) return SendClientMessage(playerid, 0xFF0000FF, "You are not driving a vehicle.");
new color[2];
if(sscanf(params, "iI(-1)", color[0], color[1]))
{
return SendClientMessage(playerid, 0xFF0000FF, "Piemers: /vcolor [krasa1] [krasa2]");
}
if(color[1] == -1) color[1] = color[0]; // If color2 was left out, set it the same as color 1
new szSuccess[44];
format(szSuccess, sizeof(szSuccess), "Vehicle colors changed to: {FFFFFF}%i and %i.", color[0], color[1]);
SendClientMessage(playerid, 0x00FF00FF, szSuccess);
ChangeVehicleColor(GetPlayerVehicleID(playerid), color[0], color[1]);
new Query[128];
format(query,sizeof(query),"UPDATE `TABLE_CARS` SET `colors` = '%i, %i' WHERE `id` = '%i'", color[0], color[1], 1);
return mysql_query(Query);
return 1;
}
http://prntscr.com/5vd34k
And heres the table Cars settings:
http://prntscr.com/5vd3kf
Also, this is how the Table_Cars define looks:
PHP код:
#define TABLE_ACCOUNT "accounts"
#define TABLE_HOUSE "house"
#define TABLE_BIZZ "bizz"
#define TABLE_CARS "cars"
#define TABLE_FRACTION "fraction"
#define TABLE_ENTERS "enters"
#define TABLE_PICK "mayor"
#define TABLE_OTHER "other"
#define TABLE_GPS "gps"
#define TABLE_VEH "vehicle"
#define TABLE_ATM "atm"
#define TABLE_GANGZONE "gangzone"
#define TABLE_MAFIA "mafia"