SA-MP Forums Archive
Will this command work ? - 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: Will this command work ? (/showthread.php?tid=284972)



Will this command work ? - Fat - 21.09.2011

pawn Код:
dcmd_createhouse(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new price, level, descri;
        new houseid = -1;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        if (sscanf(params, "ddS(No Description)[64]",price, level, descri))
            return SendClientMessage(playerid, COLOR_WHITE, "[{EE5555}USAGE{FFFFFF}]: /createhouse [price] [level] [description ( optinal )");
        if (PlayerInfo[playerid][pAdmin] >= 10)
        {
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
                if(HouseInfo[h][hExists] == 1)
                {
                    houseid = h + 1;
                }
                HouseInfo[houseid][hOwned] = 1;
                HouseInfo[houseid][hLock] = 1;
                HouseInfo[houseid][hValue] = price;
                HouseInfo[houseid][hLevel] = level;
                HouseInfo[houseid][hDiscription] = descri;
                HouseInfo[houseid][hEntrancex] = X;
                HouseInfo[houseid][hEntrancey] = Y;
                HouseInfo[houseid][hEntrancez] = Z;
                Create3DTextLabel("{FFFFFF}[{88EE88}Property{FFFFFF}]",0x00AE00FF,HouseInfo[h][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]+0.75,20.0,0,1);
                HouseInfo[houseid][hPickupID] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]);
            }
        }
    }
    OnPropUpdate();
    return 1;
}
If no, what's wrong ?


Re: Will this command work ? - [MWR]Blood - 21.09.2011

pawn Код:
new price, level, descri;
Should be
pawn Код:
new price, level, descri[64];
And just test yourself!


Re: Will this command work ? - sleepysnowflake - 21.09.2011

Run a self hosted server for testings.


Re: Will this command work ? - Fat - 21.09.2011

When I do /createhouse 10 10 for example, moves all of the houses (200 in this case) and makes their names like ' 34134 ' 265' '245 '54' '5' 135' '13' same with levels.
pawn Код:
dcmd_createhouse(playerid, params[])
{
    if(IsPlayerConnected(playerid))
    {
        new price, level;
        new houseid = -1;
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X,Y,Z);
        if (sscanf(params, "dd",price, level))
            return SendClientMessage(playerid, COLOR_WHITE, "[{EE5555}USAGE{FFFFFF}]: /createhouse [price] [level]");
        if (PlayerInfo[playerid][pAdmin] >= 10)
        {
            for(new h = 0; h < sizeof(HouseInfo); h++)
            {
                if(HouseInfo[h][hExists] == 0)
                {
                    houseid = h + 1;
                }
                HouseInfo[houseid][hOwned] = 1;
                HouseInfo[houseid][hLock] = 1;
                HouseInfo[houseid][hValue] = price;
                HouseInfo[houseid][hLevel] = level;
                HouseInfo[houseid][hEntrancex] = X;
                HouseInfo[houseid][hEntrancey] = Y;
                HouseInfo[houseid][hEntrancez] = Z;
                Create3DTextLabel("{FFFFFF}[{88EE88}Property{FFFFFF}]",0x00AE00FF,HouseInfo[h][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]+0.75,20.0,0,1);
                HouseInfo[houseid][hPickupID] = CreateDynamicPickup(1273, 1, HouseInfo[houseid][hEntrancex], HouseInfo[houseid][hEntrancey], HouseInfo[houseid][hEntrancez]);
            }
        }
    }
    OnPropUpdate();
    return 1;
}



Re: Will this command work ? - Fat - 22.09.2011

Checked, works, fixed, thanks anyway.