SA-MP Forums Archive
how to reload houses after create [MYSQL][++REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: how to reload houses after create [MYSQL][++REP] (/showthread.php?tid=576155)



how to reload houses after create [MYSQL][++REP] - simo0000 - 01.06.2015

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


AW: how to reload houses after create [MYSQL][++REP] - Kaliber - 01.06.2015

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


Re: AW: how to reload houses after create [MYSQL][++REP] - simo0000 - 01.06.2015

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;
}



Re: how to reload houses after create [MYSQL][++REP] - simo0000 - 01.06.2015

plz help


Re: how to reload houses after create [MYSQL][++REP] - simo0000 - 01.06.2015

cmon guys i need help plz


Re: how to reload houses after create [MYSQL][++REP] - bgedition - 01.06.2015

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.


Re: how to reload houses after create [MYSQL][++REP] - Konstantinos - 01.06.2015

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.


Re: how to reload houses after create [MYSQL][++REP] - simo0000 - 01.06.2015

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


Re: how to reload houses after create [MYSQL][++REP] - Konstantinos - 01.06.2015

How do you load them when the server starts?