how to make a simple house system
#1

hello, can someone tell me how to make the house system, also storing data with the help of SII.. i learned SII , so i want to store it from SII, please someone help me in this
Reply
#2

also with the command /depost and /lock, /unlock please
Reply
#3

please someone give me 1 code i want to make many houses from that
Reply
#4

"How to create a house system" in a nutshell:
  1. Create an enum with the data per house
    PHP код:
    enum MyHouseData
    {
      
    House_ID,
      
    HouseOwner[25]
      ... 
    //etc

  2. Create an array with the enum previously created
    PHP код:
    #define MAX_HOUSES_ON_MY_SERVER 100
    new MyHouses[MAX_HOUSES_ON_MY_SERVER][MyHouseData]; 
  3. Make a system for loading the houses
  4. Make a system for saving houses
  5. Make commands for changing the houses (i.e. /buythishouse /gotohouse etc)
  6. Test to see if everything is working as expected
  7. Enjoy
Good Luck!
Reply
#5

What's SII? Also you can look at current code of house systems released to get an idea of how to do it, but I can guarantee you that no one is going to create it for you.
Reply
#6

People like you underestimate what kind of procedure scripting is and how much time it can take someone.
First of all. Read the damn rules. Only 24 hour bumps are allowed.
Second:
https://sampforum.blast.hk/showthread.php?tid=399161
https://sampforum.blast.hk/showthread.php?tid=473912
Read the above or find other tutorials and i am sure you will know how to make one.
At least, if you understand it.
Nobody will simply make this for you as this is a time taking and it can be a difficult procedure.
Start on your own. Read the tutorial. And let the logic and your common sense do the rest. IF you still can not figure out how to do this. Then come here and show what you have done and what went wrong. This is not a charity but a helping board.

If you want someone to do this for you, may you be lucky enough to find a fool who does. On the other side. there are many advanced scripters willing to do this against payment. But let me guess.. you want it all for free of course.
Reply
#7

I've got no clue what SII is, for a database it's preferable to use MySQL or SQLite, as they are considered to be one of the best ones.

Anyway, the steps to making a house system is simple,
- Create an enumerator storing all the information you would want the house to have, and then create an array, for example:
Код:
#define MAX_HOUSES (100)

enum hEnum
{
     hExists,
     hID,
     hOwnerID,
     hOwner[MAX_PLAYER_NAME],
     Float: hPosX,
     Float: hPosY,
     Float: hPosZ,
};

new HouseInfo[MAX_HOUSES][hEnum];
- After doing that, you should create a new table in your preferred database and add the columns you would like to save, so in this case we would save the automatically incremented ID, the owner, his name, and the position of where the pickup would spawn.
- Make a system for saving the houses into your preferred database, store the same variables I mentioned above, or whatever variables you have in your database. This can be easily done by using:
Код:
mysql_format(connectionID, queryBuffer, sizeof(queryBuffer), "INSERT INTO houses VALUES(NULL, '%i', '%s', '%f', '%f', '%f')", userid, username, position_x, position_y, position_z);
mysql_tquery(connectionID, queryBuffer);
The above code inserts a new row into your database creating a new house.
- Obviously after saving and creating a house you need to load it, for example:
Код:
enum
{
     THREAD_LOAD_HOUSES = 1,
}

public OnGameModeInit()
{
     mysql_tquery(connectionID, "SELECT * FROM houses*, "OnQueryFinished", "ii", THREAD_LOAD_HOUSES, 0);
     return 1;
}

public OnQueryFinished(threadid, addid)
{
     new rows = cache_get_row_count(connectionID);
     switch(threadid)
     {
          case THREAD_LOAD_HOUSES:
          {
               if(rows)
               {
                    for(new i = 0; i < rows; ++i)
                    {
                         // Load the houses. An example would be to get the house's unique identification:
                         HouseInfo[i][hID] = cache_get_field_content_int(i, "id");
                    }
               }
          }
     }
}
connectionID substitutes to the connection you made in OnGameModeInit() with the database. In this case mine is named that way.
queryBuffer substitutes as a global string mainly used for formating queries, they are both defined like this (above everything else, below the includes):

Код:
new connectionID;
new queryBuffer[1024];
- After doing all of that, you should make commands to create the houses, destroy houses, change something about the houses and so on.

Hope this helped you at least a little bit.
Reply
#8

i dont want someone will create it for me , but i want to learn 1..hope i can learn from a filterscript..
i just wanted to know how to make house commands and house..from that i can understand how to make business system!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)