27.02.2019, 15:06
Can someone tell me why this CMD doesn't insert the new created garage in database? (I'm using SQLITEI).
I don't even get the message "garage created successfully etc.", but ingame mapicon label and pickup is created.
AddGarage:
I don't even get the message "garage created successfully etc.", but ingame mapicon label and pickup is created.
pawn Код:
CMD:cgarage(playerid, params[])
{
if(!IsPlayerAdmin(playerid)) return 0;
new id = Garage_FindFreeID();
if(id == -1) return SCM(playerid, COLOR_ERROR, "» Server garages limit reached.");
new price, size;
if(sscanf(params, "dd(0)", price, size))
{
SCM(playerid, COLOR_BELGREEN, "» [USAGE]: /cgarage [price] [size(default 0)]");
return SCM(playerid, COLOR_BELGREEN, "» Size: 0 - Small Garage , 1 - Medium Garage, 2 - Big Garage.");
}
if((size < 0) || (size > 2)) return SCM(playerid, COLOR_ERROR, "» Size must be from 0 to 2.");
if((price < 1) || (price > 999999)) return SCM(playerid, COLOR_ERROR, "» Invalid price.");
GetPlayerPos(playerid, GarageData[id][garageX], GarageData[id][garageY], GarageData[id][garageZ]);
GetPlayerFacingAngle(playerid, GarageData[id][garageA]);
GarageData[id][garageX] += (1.25 * floatsin(-GarageData[id][garageA], degrees));
GarageData[id][garageY] += (1.25 * floatcos(-GarageData[id][garageA], degrees));
GarageData[id][garageA] += 180.0;
GarageData[id][garageInterior] = GetPlayerInterior(playerid);
GarageData[id][garageVW] = GetPlayerVirtualWorld(playerid);
GarageData[id][garageOwnerID] = 0;
GarageData[id][garageOwned] = 0;
GarageData[id][garagePrice] = price;
GarageData[id][garagePlayerSellPrice] = 0;
GarageData[id][garageSize] = size;
format(GarageData[id][garageName], MAX_GARAGE_NAME, "-");
format(GarageData[id][garageOwnerName], MAX_PLAYER_NAME, "-");
GarageData[id][garageVaultMoney] = 0;
GarageData[id][garageLockMode] = LOCK_MODE_NOLOCK;
format(GarageData[id][garagePassword], MAX_GARAGE_PASSWORD, "-");
UpdateGarageLabel(id);
GarageData[id][garageExists] = true;
stmt_bind_value(AddGarage, 0, DB::TYPE_INTEGER, id);
stmt_bind_value(AddGarage, 1, DB::TYPE_FLOAT, GarageData[id][garageX]);
stmt_bind_value(AddGarage, 2, DB::TYPE_FLOAT, GarageData[id][garageY]);
stmt_bind_value(AddGarage, 3, DB::TYPE_FLOAT, GarageData[id][garageZ]);
stmt_bind_value(AddGarage, 4, DB::TYPE_FLOAT, GarageData[id][garageA]);
stmt_bind_value(AddGarage, 5, DB::TYPE_INTEGER, GarageData[id][garageInterior]);
stmt_bind_value(AddGarage, 6, DB::TYPE_INTEGER, GarageData[id][garageVW]);
stmt_bind_value(AddGarage, 7, DB::TYPE_INTEGER, GarageData[id][garageOwnerID]);
stmt_bind_value(AddGarage, 8, DB::TYPE_INTEGER, GarageData[id][garageOwned]);
stmt_bind_value(AddGarage, 9, DB::TYPE_INTEGER, GarageData[id][garagePrice]);
stmt_bind_value(AddGarage, 10, DB::TYPE_INTEGER, GarageData[id][garagePlayerSellPrice]);
stmt_bind_value(AddGarage, 11, DB::TYPE_INTEGER, GarageData[id][garageSize]);
stmt_bind_value(AddGarage, 12, DB::TYPE_STRING, GarageData[id][garageName]);
stmt_bind_value(AddGarage, 13, DB::TYPE_STRING, GarageData[id][garageOwnerName]);
stmt_bind_value(AddGarage, 14, DB::TYPE_INTEGER, GarageData[id][garageVaultMoney]);
stmt_bind_value(AddGarage, 15, DB::TYPE_INTEGER, GarageData[id][garageLockMode]);
stmt_bind_value(AddGarage, 16, DB::TYPE_STRING, GarageData[id][garagePassword]);
if(stmt_execute(AddGarage)) SCM(playerid, COLOR_YELLOW, "» Garage created successfully at your position!");
return 1;
}
pawn Код:
AddGarage = db_prepare(GarageDB, "INSERT INTO garages (ID, garageX, garageY, garageZ, garageA, garageInterior, garageVW, garageOwnerID, garageOwned, garagePrice, garagePlayerSellPrice, garageSize, garageName, garageOnwerName, garageVaultMoney, garageLockMode, garagePassword) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");