How comes this gives random numbers in scriptfiles
#4

You can add a id parametre into your command, so it sets those houses to that id.

Take a look:

pawn Код:
CMD:createhouse(playerid, params[])
{
    new HousePrice, houseid;
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "You must be a admin to use that command");
    if(sscanf(params,"ii", houseid, HousePrice)) return SendClientMessage(playerid, COLOR_GREEN, "/createhouse [id] [houseprice]");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    HouseInfo[houseid][hPrice] = HousePrice;
    HouseInfo[houseid][hOwned] = 0;
    HouseInfo[houseid][XPos] = x;
    HouseInfo[houseid][YPos] = y;
    HouseInfo[houseid][ZPos] = z;
    HouseInfo[houseid][VirtualWorld] = GetPlayerVirtualWorld(playerid);
    format(HouseInfo[houseid][hOwner],24,"NoNameForThisHouse");
    SendClientMessage(playerid, COLOR_GREEN, "House created");
    HouseInfo[houseid][hEnter] = AddStaticPickup(1273, -1, x, y, z, 0);
    GetPlayerName(playerid,pname,sizeof(pname));
    new INI:File = INI_Open(HousePath(houseid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"HousePrice", HouseInfo[houseid][hPrice]);
    INI_WriteInt(File,"HouseOwned", HouseInfo[houseid][hOwned]);
    INI_WriteInt(File,"HouseOwner", HouseInfo[houseid][hOwner]);
    INI_WriteInt(File,"HouseEnter", HouseInfo[houseid][hEnter]);
    INI_WriteFloat(File,"HouseXPos", HouseInfo[houseid][XPos]);
    INI_WriteFloat(File,"HouseYPos", HouseInfo[houseid][YPos]);
    INI_WriteFloat(File,"HouseZPos", HouseInfo[houseid][ZPos]);
    INI_WriteInt(File,"VirtualWorld", HouseInfo[houseid][VirtualWorld]);
    INI_Close(File);
    return 1;
}
Please give me reputation if I helped.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)