27.08.2013, 22:11
The command, when processed, sets the house price to something stupid - for example, if I did /sethouseprice 100000 it would set the price to $51...
pawn Код:
YCMD:sethouseprice(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Updates a houses description");
return 1;
}
new house = getStandingHouse(playerid);
if(house == -1) {
SendClientMessage(playerid, X11_TOMATO_2, "You must be standing near a house");
return 1;
}
new price[64],price_esc[(sizeof(price)*2)+1];
if(!sscanf(params,"s[64]", price)) {
query[0] = 0;
mysql_real_escape_string(price, price_esc);
format(Houses[house][EHouseValue],64,"%s",price);
format(query, sizeof(query), "UPDATE `houses` SET `price` = \"%s\" WHERE `id` = %d", price_esc, Houses[house][EHouseSQLID]);
mysql_function_query(g_mysql_handle, query, true, "EmptyCallback", "");
new labeltext[128];
getHouseTextLabel(house, labeltext, sizeof(labeltext));
UpdateDynamic3DTextLabelText(Houses[house][EHouseTextLabel],0x00FF00FF, labeltext);
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /sethouseprice [price]");
SendClientMessage(playerid, X11_WHITE, "You must be standing at the house pickup to do this.");
}
return 1;
}