"Refreshing" a certain house
#5

Creating the house is done by using "INSERT INTO" function:
pawn Код:
CMD:createhouse(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] >= 3)
    {
        new Float:X, Float:Y, Float:Z, Float:X2, Float:Y2, Float:Z2, price, interior;
        GetPlayerPos(playerid, X2, Y2, Z2);
        if(sscanf(params, "fffdd", X, Y, Z, interior, price)) return SendClientMessage(playerid, COLOR_RED, "Error:"COL_WHITE" /createhouse [IntX] [IntY] [IntZ] [InteriorID] [Price]");
        format(query, sizeof(query), "INSERT INTO `houses` (IntX, IntY, IntZ, ExtX, ExtY, ExtZ, Price, Interior) VALUES ('%f', '%f', '%f', '%f', '%f', '%f', '%d', '%d')", X, Y, Z, X2, Y2, Z2, price, interior);
        mysql_query(sqldb, query);
        SendClientMessage(playerid, COLOR_GREEN, "Houses has been created and inserted into the database.");
    }
    return true;
}
Since INSERT INTO already auto increments the ID.
Reply


Messages In This Thread
"Refreshing" a certain house - by BleverCastard - 21.06.2014, 21:53
Re: "Refreshing" a certain house - by Cypress - 21.06.2014, 22:12
Re: "Refreshing" a certain house - by BleverCastard - 21.06.2014, 22:14
Re: "Refreshing" a certain house - by Cypress - 21.06.2014, 22:16
Re: "Refreshing" a certain house - by BleverCastard - 21.06.2014, 22:23
Re: "Refreshing" a certain house - by Cypress - 21.06.2014, 22:30
Re: "Refreshing" a certain house - by BleverCastard - 21.06.2014, 22:31
Re: "Refreshing" a certain house - by Cypress - 21.06.2014, 22:33
Re: "Refreshing" a certain house - by BleverCastard - 21.06.2014, 22:34
Re: "Refreshing" a certain house - by iCuttah - 21.06.2014, 22:36

Forum Jump:


Users browsing this thread: 1 Guest(s)