Originally Posted by SymonClash
Thank you both.
@Calisthenics, this is what Vehicle_Save and Vehicle_Refresh do:
pawn Код:
stock Vehicle_Save(vid) { static query[256];
format(query, sizeof(query), "UPDATE `vehicles` SET `vehicleOwner` = '%e', `vehicleX` = '%.4f', `vehicleY` = '%.4f', `vehicleZ` = '%.4f', `vehicleA` = '%.4f', `vehicleInterior` = '%d', `vehicleWorld` = '%d' WHERE `vehicleDBID` = '%d'", VehicleData[vid][vehicleOwner], VehicleData[vid][vehiclePos][0], VehicleData[vid][vehiclePos][1], VehicleData[vid][vehiclePos][2], VehicleData[vid][vehiclePos][3], VehicleData[vid][vehicleInterior], VehicleData[vid][vehicleWorld], VehicleData[vid][vehicleDBID] ); return mysql_tquery(mysql, query); }
pawn Код:
stock Vehicle_Refresh(vid) { if(vid != -1 && VehicleData[vid][vehicleExists] && VehicleData[vid][vehicleOwned] == 0) { static string[128];
if(IsValidDynamic3DTextLabel(VehicleData[vid][vehicleLabel])) DestroyDynamic3DTextLabel(VehicleData[vid][vehicleLabel]);
VehicleData[vid][vehicleDBID] = CreateVehicle(vid, VehicleData[vid][vehiclePos][0], VehicleData[vid][vehiclePos][1], VehicleData[vid][vehiclePos][2], VehicleData[vid][vehiclePos][3], VehicleData[vid][vehicleColorOne], VehicleData[vid][vehicleColorOne], 10);
format(string, sizeof(string), "%s - For Sale (%s)", VehicleData[vid][vehicleName], VehicleData[vid][vehiclePrice]); VehicleData[vid][vehicleLabel] = CreateDynamic3DTextLabel(string, -1, VehicleData[vid][vehiclePos][0], VehicleData[vid][vehiclePos][1], VehicleData[vid][vehiclePos][2], 15.0, INVALID_VEHICLE_ID, INVALID_PLAYER_ID, 0, VehicleData[vid][vehicleWorld], VehicleData[vid][vehicleInterior]);
UpdateDynamic3DTextLabelText(VehicleData[vid][vehicleLabel], -1, string); } return 1; }
Edit: Now the command is this:
pawn Код:
CMD:createvehicle(playerid, params[]) { if(IsPlayerInAnyVehicle(playerid)) return SCM(playerid, COLOR_ERROR, "* You must be on foot to create a vehicle."); if(Vehicle_Nearest(playerid) != -1) return SCM(playerid, COLOR_ERROR, "* You can't create a vehicle near another one."); new modelid[30], vehid, color1, color2, price; if(sscanf(params, "s[30]iid", modelid, color1, color2, price)) return SCM(playerid, COLOR_BELGREEN, "* [USAGE]: /createvehicle <ModelID/Vehicle Name> <Color1> <Color2> <Price>");
if(IsNumeric(modelid)) vehid = strval(modelid); else vehid = ReturnVehicleModelID(modelid);
if(vehid < 400 || vehid > 611) return SCM(playerid, COLOR_ERROR, "* Invalid vehicle model.");
static Float:x, Float:y, Float:z, Float:angle; GetPlayerPos(playerid, x, y, z); GetPlayerFacingAngle(playerid, angle);
for (new i = 0; i != MAX_VEH; i ++) if(!VehicleData[i][vehicleExists]) { new query[1000]; new player_interior = GetPlayerInterior(playerid), player_virtual_world = GetPlayerVirtualWorld(playerid);
mysql_format(mysql, query, sizeof(query), "INSERT INTO vehicles \ SET vehicleName='%e', \ vehicleOwner='-', \ vehiclePlate='SSRP', \ vehicleModel=%d, \ vehiclePrice=%d, \ vehicleColorOne=%d, \ vehicleColorTwo=%d, \ vehicleX=%f, \ vehicleY=%f, \ vehicleZ=%f, \ vehicleA=%f, \ vehicleInterior=%d, \ vehicleWorld=%d, \ vehicleOwned=0",
GetVehicleName(vehid), vehid, price, color1, color2, x, y, z, angle, player_interior, player_virtual_world);
mysql_tquery(mysql, query, "OnVehicleCreate", "dddddffffdd", veh_index, vehid, price, color1, color2, x, y, z, angle, player_interior, player_virtual_world);
if(!VehicleData[i][vehicleExists]) return 0; } return 1; }
But getting undefined symbol "veh_index" at the tquery line.
|