MYSQL | Vehicle System
#3

enum VehicleStats
{
vID,
vModel,
Float:vPosition[4],
vOwner[24],
vColor1,
vColor2,
}
new Vehicle[MAX_VEHICLES][VehicleStats];

COMMAND:createvehicle(playerid, params[])
{
new vModelT, i, Floatosx, Floatosy, Floatosz, Floatosa, vColor1T, vColor2T, query[228], string[128];
if(sscanf(params, "ddd[128]", vModelT, vColor1T, vColor2T)) return SendClientMessage(playerid, COLOR_GREY, "[Command] Usage: /createvehicle [ModelID] [Color1] [Color2]");
GetPlayerPos(playerid, posx, posy, posz);
GetPlayerFacingAngle(playerid, posa);
if(vModelT < 411 || vModelT > 611) return SendClientMessage(playerid, COLOR_GREY, "Model ID Must not be below 411 and not higher than 611");
i = mysql_insert_id();
format(query, sizeof(query), "INSERT INTO vehicles (VehicleID, VehicleModel, VehiclePosx, VehiclePosy, VehiclePosz, VehiclePosa, VehicleColor1, VehicleColor2) VALUES('%d', '%d', '%f', '%f', '%f', '%f', '%d', '%d'", i, vModelT, posx, posy, posz, posa, vColor1T, vColor2T);
mysql_query(query);
Vehicle[i][vID] = i;
Vehicle[i][vModel] = vModelT;
Vehicle[i][vPosition][0] = posx;
Vehicle[i][vPosition][1] = posy;
Vehicle[i][vPosition][2] = posz;
Vehicle[i][vPosition][3] = posa;
Vehicle[i][vColor1] = vColor1T;
Vehicle[i][vColor2] = vColor2T;
format(string, sizeof(string), "Vehicle Created! Vehicle ID : %d | Vehicle ModelID : %d | Vehicle Color1And2 : 5 | Vehicle PosX : %f | Vehicle PosY : %f | Vehicle PosZ : %f | Vehicle PosA : %f", i, vModelT, posx, posy, posz, posa);
SendClientMessage(playerid, COLOR_GREY, string);
return 1;
}
Reply


Messages In This Thread
MYSQL | Vehicle System - by yoran765 - 11.12.2013, 20:11
Re: MYSQL | Vehicle System - by Vince - 11.12.2013, 20:53
Re: MYSQL | Vehicle System - by HK - 11.12.2013, 21:24
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 05:51
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 05:56
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 15:49
Re: MYSQL | Vehicle System - by Tayab - 12.12.2013, 17:27
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 18:10
Re: MYSQL | Vehicle System - by yoran765 - 12.12.2013, 18:29
Re: MYSQL | Vehicle System - by yoran765 - 16.12.2013, 06:24

Forum Jump:


Users browsing this thread: 1 Guest(s)