11.05.2015, 17:59
I'm using a simple script to create a vehicle but it wont spawn. This is the code and only the textdraw spawns..
Код:
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[128], tmp[128];//Creating the house price for the selected value in the command, and the last house id created. if(sscanf(params,"is",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); Vehicle[id][VehicleID] = id;//Setting the house price to the selected one. Vehicle[id][Model] = CarModel;//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] = 133;//Setting the house price to the selected one. Vehicle[id][Color2] = 133;//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. new CarID = GetCarIDFromName(CarModel); 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)); 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` (`Model`,`PosX`, `PosY`, `PosZ`, `PosA`, `Color1`, `Color2`,`Respawn`,`OwnerID`,`Owned`,`Freezed`,`Price`) VALUES ('%i',%f,%f,%f,%f,'%i','%i','%i','%i','%i','%i','%i')",CarID,Vehicle[id][PosX],Vehicle[id][PosY],Vehicle[id][PosZ],Vehicle[id][PosA],Vehicle[id][Color1],Vehicle[id][Color2],Vehicle[id][Respawn],Vehicle[id][OwnerID],Vehicle[id][Owned],Vehicle[id][Freezed],Vehicle[id][Price]); mysql_tquery(g_SQL, query, "NewHouseReload", ""); return 1; }