17.03.2018, 13:19
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
enum MyHouseData
{
House_ID,
HouseOwner[25]
... //etc
}
#define MAX_HOUSES_ON_MY_SERVER 100
new MyHouses[MAX_HOUSES_ON_MY_SERVER][MyHouseData];
#define MAX_HOUSES (100) enum hEnum { hExists, hID, hOwnerID, hOwner[MAX_PLAYER_NAME], Float: hPosX, Float: hPosY, Float: hPosZ, }; new HouseInfo[MAX_HOUSES][hEnum];
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);
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"); } } } } }
new connectionID; new queryBuffer[1024];