22.02.2019, 10:19
Basically on the garage system im making, i did a /sellgarage cmd where players can put for sale their garages.
Admins can do /creategarage for creating them. I create a garage, their ID is 1 (which is correct), so the creation part works.
The problem comes with the /sellgarage CMD, even if the garageID exists, it says i've specified an invalid garage ID.
What the hell is wrong?
garageID is set as AUTO_INCREMENT on database, which increases by 1 everytime i create a new garage with /creategarage.
I've created 1 garage for testing, ID 1, i'm trying to sell it but i get that stupid message "you've specified an invalid garage ID" even if the garage ID 1 exists in the database.
Admins can do /creategarage for creating them. I create a garage, their ID is 1 (which is correct), so the creation part works.
The problem comes with the /sellgarage CMD, even if the garageID exists, it says i've specified an invalid garage ID.
pawn Код:
CMD:sellgarage(playerid, params[])
{
new id;
new price;
if(sscanf(params, "di", id, price)) return SCM(playerid, COLOR_BELGREEN, "» [USAGE]: /sellgarage [garage ID] [price]");
if((id < 1 || id >= MAX_GARAGES) || !GarageInfo[id][garageExists]) return SCM(playerid, COLOR_ERROR, "» You have specified an invalid garage ID.");
if(GarageInfo[id][garageOwnerID] != Player[playerid][ID]) return SCM(playerid, COLOR_ERROR, "» This garage is not yours.");
if(!GarageInfo[id][garageOwned]) return SCM(playerid, COLOR_ERROR, "» This garage can't be put for sale because it's unowned.");
if(GarageInfo[id][garagePlayerSellPrice] > 0) return SCM(playerid, COLOR_ERROR, "» This garage is already for sale. If you wish to change the price, you can use /changegarageprice.");
if((price < 1) || (price > 999999)) return SCM(playerid, COLOR_ERROR, "» Invalid price.");
PutGarageForSale(playerid, id, price);
RefreshGarage(id);
return 1;
}
garageID is set as AUTO_INCREMENT on database, which increases by 1 everytime i create a new garage with /creategarage.
I've created 1 garage for testing, ID 1, i'm trying to sell it but i get that stupid message "you've specified an invalid garage ID" even if the garage ID 1 exists in the database.