Command doesn't work as intended
#1

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;
}
Reply
#2

I'm not really sure why it does not work. Although, have you ever heard of integers? Price can be used/saved as integer.
Reply
#3

Anyone?
Reply
#4

51 is character '3' in ascii table. Seriously, change your database to hold price as a number, not a string
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)