SA-MP Forums Archive
Selling all houses - 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: Selling all houses (/showthread.php?tid=542259)



Selling all houses - Mriss - 18.10.2014

Is this script correct?

pawn Код:
CMD:sellallhouses(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 99999)
    {
        for (new HouseID = 0; HouseID < MAX_HOUSES; HouseID++)
        ClearHouse(HouseID);
        HouseInfo[HouseID][hGLUpgrade] = 1;
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
if not please tellme whats wrong / give me script fixed


Re: Selling all houses - nemesis- - 18.10.2014

Your for loop inside the if() is missing brackets encasing the functions. You also won't need the return 1; since you have one at the end of the function.


Re: Selling all houses - Eth - 18.10.2014

Quote:
Originally Posted by nemesis-
Посмотреть сообщение
Your for loop inside the if() is missing brackets encasing the functions. You also won't need the return 1; since you have one at the end of the function.
this.
pawn Код:
CMD:sellallhouses(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 99999)
    {
        for (new HouseID = 0; HouseID < MAX_HOUSES; HouseID++)
        {
        ClearHouse(HouseID);
        HouseInfo[HouseID][hGLUpgrade] = 1;
        }
        return 1;
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You are not authorized to use that command!");
    }
    return 1;
}
also I think that you need to check if the houseID is an invalid ID or not, it's better than doing that even for unsued House slots.