SA-MP Forums Archive
Help createHouse command MYSQL - 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: Help createHouse command MYSQL (/showthread.php?tid=522065)



Help createHouse command MYSQL - Cam972 - 25.06.2014

hi,

i need some help to create a mysql house system.

Create houses in game with a command : /Createhouse

but i have some problems, nothing IG but they are rows in my sql database but the value, level etc didnt correspond of the value i'm entered with the command

http://pastebin.com/x0MDt7GL


Re: Help createHouse command MYSQL - Jack_Leslie - 25.06.2014

pawn Код:
CMD:createhouse(playerid, params[])
    {
    new query[1000];
    new house;
    new Float:iX, Float:iY, Float:iZ; // These end up being empty floats
    new Float:X, Float:Y, Float:Z; // These end up being the players position but used for the exit
    new level, value, idi;
    if(sscanf(params,"dfffdd",idi,iX,iY,iZ,level, value)) return SendClientMessage(playerid,  Gris, "Utilisation: /createhouse : [IDinterieur] [Interieur] [Level] [Prix]");
        GetPlayerPos(playerid, X,Y,Z);
        HouseInfo[house][hEntrancex] = iX;
        HouseInfo[house][hEntrancex] = iY;
        HouseInfo[house][hEntrancex] = iZ;
        HouseInfo[house][hExitx] = X;
        HouseInfo[house][hExity] = Y;
        HouseInfo[house][hExitz] = Z;
        HouseInfo[house][hLevel] = level;
        HouseInfo[house][hInt] = idi;
        HouseInfo[house][ID] = HouseInfo[house][hWorld];
        HouseInfo[house][hValue] = value;
    HouseInfo[house][hHealthy] = 0;
    HouseInfo[house][hHealthz] = 0;
        HouseInfo[house][hHel] = 0;
        HouseInfo[house][hArm] = 0;
    HouseInfo[house][hHealthx] = 0;
    HouseInfo[house][hHealthy] = 0;
        HouseInfo[house][hHealthz] = 0;
    HouseInfo[house][hArmourx] = 0;
    HouseInfo[house][hArmoury] = 0;
    HouseInfo[house][hArmourz] = 0;
    HouseInfo[house][hLock] = 1;
        HouseInfo[house][hOwned] = 0;
    HouseInfo[house][hTakings] = 0;
    HouseInfo[house][hSecurity] = 0;
    HouseInfo[house][hCoffre] = 0;
    CreatePickup(1273, 1, iX, iY, iZ, -1);
        strmid(HouseInfo[house][hOwner], "Le Gouvernement", 0, strlen("Le Gouvernement"), 255);
        mysql_format(mysql, query, sizeof(query), "INSERT INTO `maisons`(`ID`, `hEntrancex`, `hEntrancey`, `hEntrancez`, `hExitx`, `hExity`, `hExitz`, `hOwner`, `hDiscription`, `hValue`,`hLevel`, `hInt`, `hLock`, `hOwned`, `hWorld`) VALUES ('%d', '%f', '%f', '%f', '%f', '%f', '%f', '%s', '%s', '%d', '%d', '%d', '%d', '%d', '%d')", idi, X,Y,Z,iX,iY,iZ,hOwner,hDiscription,hValue,hLevel,hInt,hLock,hOwned,hWorld);
            mysql_tquery(mysql, query, "", "");
        return 1;
    }
See the floats I have commented, you are setting the house entrance as them, but you're not getting the position for them. You're getting the players position and storing them into X, Y, Z. iX, iY and iZ end up being empty floats.


Re : Help createHouse command MYSQL - Cam972 - 26.06.2014

Fixed (y) thanks