11.05.2015, 22:14
Here is the debug:
Here is the code:
Код:
INSERT INTO `cars_system` (`VehicleID`,`Model``Color1`, `Color2`,`Respawn`,`OwnerID`,`Owned`,`Freezed`,`Price`,`Engine`,`Lights`,`Alarm`,`Doors`,`Hood`,`Trunk`,`Object`,`PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('1','402','-1','-1','-1','0','0','1','33','0',
Код:
CMD:spawncar(playerid,params[]) { if(Player[playerid][AdminLevel] <= 2) return SendClientMessage(playerid,-1,"You aren't an admin!");//Check if the player is currently rcon logged in. new CarPrice,id = CarsCount,CarModel[32], tmp[128]; if(sscanf(params,"is[32]",CarPrice, CarModel)) return SendClientMessage(playerid,-1,"USAGE: /spawncar <price> <model>");//Checking if the player uses the correct syntax. The parameter "i" in sscanf means integer, also could be used as "d". new Float:x,Float:y,Float:z, Float: Angle;//Creating the floats, to store the player's position. GetPlayerPos(playerid,x,y,z);//Getting the player's position and storing it GetPlayerFacingAngle(playerid, Angle); new CarID = GetCarIDFromName(CarModel); Vehicle[id][VehicleID] = id;//Setting the house price to the selected one. Vehicle[id][Model] = CarID;//Setting the house price to the selected one. Vehicle[id][PosX] = x;//Setting the house price to the selected one. Vehicle[id][PosY] = y;//Setting the house price to the selected one. Vehicle[id][PosZ] = z;//Setting the house price to the selected one. Vehicle[id][PosA] = Angle;//Setting the house price to the selected one. Vehicle[id][Color1] = -1;//Setting the house price to the selected one. Vehicle[id][Color2] = -1;//Setting the house price to the selected one. Vehicle[id][Respawn] = -1;//Setting the house price to the selected one. Vehicle[id][OwnerID] = 0;//Setting the house price to the selected one. Vehicle[id][Owned] = 0;//Setting the house price to the selected one. Vehicle[id][Freezed] = 1;//Setting the house price to the selected one. Vehicle[id][Price] = CarPrice;//Setting the house price to the selected one. Vehicle[id][Engine] = 0;//Setting the house price to the selected one. Vehicle[id][Lights] = 0;//Setting the house price to the selected one. Vehicle[id][Doors] = 0;//Setting the house price to the selected one. Vehicle[id][Alarm] = 0;//Setting the house price to the selected one. Vehicle[id][Hood] = 0;//Setting the house price to the selected one. Vehicle[id][Trunk] = 0;//Setting the house price to the selected one. Vehicle[id][Object] = 1;//Setting the house price to the selected one. if (CarID == -1) return SendClientMessage(playerid, -1, "Invalid car name"); Player[playerid][pSpawnVehicle] = CreateVehicle(CarID, x, y, z, Angle, Vehicle[id][Color1], Vehicle[id][Color2], -1); LinkVehicleToInterior(Player[playerid][pSpawnVehicle], GetPlayerInterior(playerid)); SetVehicleParamsEx(Player[playerid][pSpawnVehicle], Vehicle[id][Engine], Vehicle[id][Lights], Vehicle[id][Alarm], Vehicle[id][Doors], Vehicle[id][Hood], Vehicle[id][Trunk], Vehicle[id][Object]); PutPlayerInVehicle(playerid, Player[playerid][pSpawnVehicle], 0); format(tmp, sizeof(tmp), "[CAR FOR SALE]\n{FFFFFF}Owner: Dealership \nPrice: $%d",Vehicle[id][Price]); Create3DTextLabel(tmp, COLOR_SYNTAX,x,y,z, 40.0,0,0); SendClientMessage(playerid,-1,"Car spawned"); CarsCount++; new query[256]; mysql_format(g_SQL, query, sizeof(query), "INSERT INTO `cars_system` (`VehicleID`,`Model``Color1`, `Color2`,`Respawn`,`OwnerID`,`Owned`,`Freezed`,`Price`,`Engine`,`Lights`,`Alarm`,`Doors`,`Hood`,`Trunk`,`Object`,`PosX`, `PosY`, `PosZ`, `PosA`) VALUES ('%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i','%i',%f,%f,%f,%f)", CarsCount,CarID,Vehicle[id][Color1],Vehicle[id][Color2],Vehicle[id][Respawn],Vehicle[id][OwnerID],Vehicle[id][Owned],Vehicle[id][Freezed],Vehicle[id][Price],Vehicle[id][Engine],Vehicle[id][Lights],Vehicle[id][Alarm],Vehicle[id][Doors],Vehicle[id][Hood],Vehicle[id][Trunk],Vehicle[id][Object],Vehicle[id][PosX],Vehicle[id][PosY],Vehicle[id][PosZ],Vehicle[id][PosA]); mysql_tquery(g_SQL, query, "", ""); printf(query); return 1; }