[HELP] MySQL saving house
#8

sorry for double post, I've made something
pawn Код:
/*
 * S32House - Create house with just one line (MySQL)!
 * Copyright©System32
 * This file is provided as is (no warranties)
 */

#if defined _S32House_included
  #endinput
#endif
#define _S32House_included
#include <a_samp>
#include <a_mysql>
#include <YSI\y_commands>

#define MAX_HOUSE 150

enum hInfo
{
    hOwner,
    hEnterX,
    hEnterY,
    hEnterZ,
    hInteriorX,
    hInteriorY,
    hInteriorZ,
    hInterior,
    hVirtualWorld,
    hHouseID,
    hPrice
};
new HouseInfo[MAX_HOUSE][hInfo];

//new PlayerHaveHouse[MAX_PLAYERS];
new House = -1, House_Price[MAX_HOUSE] = 0, Buy_House[sizeof(House)], CurrentHouse = -1;
new Label = -1;
new Text3D: LabelMake[sizeof(Label)];
new hstring[128] = -1, stringmake[sizeof(hstring)];
new hescpname[24];
new HQuery[300];
   
stock CreateDynamicHouse(Float: EnterX, Float: EnterY, Float: EnterZ, Interior, Float: InteriorX, Float: InteriorY, Float: InteriorZ, Price, VirtualWorld, HouseID)
{
    CurrentHouse += 1;
    House += 1;
    House_Price[House] = Price;
    Buy_House[House] = CreatePickup(1239, 2, EnterX, EnterY, EnterZ, -1);
    hstring[126] += 1;
    format(hstring, sizeof(hstring), "For sale!\nPrice: %d\nType /buyhouse to buy house!", Price);
    Label += 1;
    LabelMake[Label] = Create3DTextLabel(hstring, 0x21DD00FF, EnterX, EnterY, EnterZ, 40.0, 0);

    for(new i=0; i < 2; i++)
    {
        EnterX = HouseInfo[i][hEnterX];
        EnterY = HouseInfo[i][hEnterY];
        EnterZ = HouseInfo[i][hEnterZ];
        InteriorX = HouseInfo[i][hInteriorX];
        InteriorY = HouseInfo[i][hInteriorY];
        InteriorZ = HouseInfo[i][hInteriorZ];
        Interior = HouseInfo[i][hInterior];
        VirtualWorld = HouseInfo[i][hVirtualWorld];
        Price = HouseInfo[i][hPrice];
        HouseID = HouseInfo[i][hHouseID];
        mysql_real_escape_string(GetName(i), hescpname);
        format(HQuery, sizeof(HQuery), "INSERT INTO `house` (`User`, `EnterX`, `EnterY`, `EnterZ`, `Interior`, `InteriorX`, `InteriorY`, `InteriorZ`, `Price`, `VirtualWorld`, `HouseID`) VALUES ('%s', '%f', '%f', '%f', '%d', '%f', '%f', '%f', '%d', '%d', '%d')", hescpname, HouseInfo[i][hEnterX], HouseInfo[i][hEnterY], HouseInfo[i][hEnterZ], HouseInfo[i][hInteriorX], HouseInfo[i][hInteriorY], HouseInfo[i][hInteriorZ], HouseInfo[i][hVirtualWorld], HouseInfo[i][hPrice], HouseInfo[i][hHouseID]);
        mysql_query(HQuery);
    }
    return 1;
}
so, when I open up my database, there is a lot of houses, it's not just 2 (i've put 2 in OnGameModeInit) & noone of them doesn't show right coordinates, etc.
Reply


Messages In This Thread
[HELP] MySQL saving house - by System64 - 08.09.2011, 12:27
Re: [HELP] MySQL saving house - by THE_KNOWN - 08.09.2011, 13:30
Re: [HELP] MySQL saving house - by System64 - 08.09.2011, 13:33
Re: [HELP] MySQL saving house - by Vince - 08.09.2011, 13:35
Re: [HELP] MySQL saving house - by Farsek - 08.09.2011, 13:36
Re: [HELP] MySQL saving house - by System64 - 08.09.2011, 13:53
Re: [HELP] MySQL saving house - by System64 - 08.09.2011, 15:51
Re: [HELP] MySQL saving house - by System64 - 08.09.2011, 18:20
Re: [HELP] MySQL saving house - by System64 - 09.09.2011, 09:33
Re: [HELP] MySQL saving house - by MadeMan - 09.09.2011, 09:46

Forum Jump:


Users browsing this thread: 3 Guest(s)