how to reload houses after create [MYSQL][++REP]
#1

i have a house system when i create a house i need to restart server to see pickup , name, owner etc...
so i need a function which it's reload house after create
plz help me
sorry for my bad english
Reply
#2

Maybe...give us your code how you create & save the house...
Reply
#3

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
Maybe...give us your code how you create & save the house...
okay

create house cmd
pawn Код:
CMD:createhouse(playerid, params[])
{
    static Float:IntX;
    static Float:IntY;
    static Float:IntZ;
    static Float:ExtX;
    static Float:ExtY;
    static Float:ExtZ;
    static Interior;
    static RWorld;
   
    new string[256], Section[9];
    if(IsPlayerAdmin(playerid))
    {
        if(sscanf(params, "s[9]", Section)) return SendClientMessage(playerid, COLOR_WHITE, "Server: /createhouse [exterior/interior/complete]");
        {
            if(strmatch("interior", Section))
            {
                GetPlayerPos(playerid, IntX, IntY, IntZ);
                Interior = GetPlayerInterior(playerid);
                format(string, sizeof(string), "Interior set. (%f %f %f - %d)", IntX, IntY, IntZ, Interior);
                SendClientMessage(playerid, COLOR_WHITE, string);
            }
            else if(strmatch("exterior", Section))
            {
                GetPlayerPos(playerid, ExtX, ExtY, ExtZ);
                format(string, sizeof(string), "Exterior set. (%f %f %f)", ExtX, ExtY, ExtZ);
                SendClientMessage(playerid, COLOR_WHITE, string);
            }
            else if(strmatch("complete", Section))
            {
                format(string, sizeof(string), "House added.");
                printf("%f, %f, %f, %f, %f, %f, %i", ExtX, ExtY, ExtZ, IntX, IntY, IntZ, Interior);
                SendClientMessage(playerid, COLOR_WHITE, string);
                SetPlayerPos(playerid, ExtX, ExtY, ExtZ);
                SetPlayerInterior(playerid, 0);
                new rand = random(12345);
                RWorld = rand;
                SaveHouse(ExtX, ExtY, ExtZ, IntX, IntY, IntZ, Interior, RWorld);
            }
            else return SendClientMessage(playerid, COLOR_WHITE, "Server: /addhouse [exterior/interior/complete]");
        }
    }
    else return SendClientMessage(playerid, COLOR_GREY, "You Aren't Admin");
    return 1;
}
savehouse function
pawn Код:
stock SaveHouse(Float:ExtX, Float:ExtY, Float:ExtZ, Float:IntX, Float:IntY, Float:IntZ, IntID, RWorld)
{
    new
        Query[2000];
       
    mysql_format(mysql, Query, sizeof(Query), "INSERT INTO `Houses` (`HouseName`, `HouseOwner`, `ExteriorX`, `ExteriorY`, `ExteriorZ`, `InteriorX`, `InteriorY`, `InteriorZ`, `InteriorID`, `HousePrice`, `HouseLocked`, `HouseWorld`) VALUES('NotSet', 'Nobody', '%f', '%f', '%f', '%f', '%f', '%f', '%i', '25000', '0', '%i')", ExtX, ExtY, ExtZ, IntX, IntY, IntZ, IntID, RWorld);
    mysql_query(mysql, Query);
    mysql_free_result();
    return 1;
}
Reply
#4

plz help
Reply
#5

cmon guys i need help plz
Reply
#6

I think the best way to do this is to make the house system in filterscript. Then ingame type /rcon unloadfs <the name of your filterscript> and then type /rcon loadfs <the name of your filterscript>. Also to do this you need to be rcon admin(/rcon login <your rcon password>). I think this will be the best way. When you use /rcon reload fs <name> the server is not completely unloading the filterscript it is small part(I think) of it.
Reply
#7

That's because you only insert the data in the database and you store them in local (temporary) variables.

You neither create the pickup etc in SaveHouse, nor store them to a global array so you can access those data later on.
Reply
#8

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
That's because you only insert the data in the database and you store them in local (temporary) variables.

You neither create the pickup etc in SaveHouse, nor store them to a global array so you can access those data later on.
but how to reload house after create can you help me ?

thanks
Reply
#9

How do you load them when the server starts?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)