[HELP]: House System
#4

pawn Код:
enum HouseInfo
{
    HouseID,
    Owner[24],
    Owned,
    Price,
    Float:posX,
    Float:posY,
    Float:posZ,
    VirtualWorld,
    Text3D:HouseLabel,
    Size,
}
new hInfo[MAX_HOUSES][HouseInfo];
And /makehouse

pawn Код:
CMD:makehouse(playerid,params[])
{
    new HousePrice; new id = HouseCount; new size;
    if(sscanf(params, "ii", HousePrice, size))return SendClientMessage(playerid, -1, "USAGE: /makehouse <Price> <Size>");
    if(size >= 4)return SendClientMessage(playerid, -1, "Max size: 3 | Min size: 1");
    if(size <= 0)return SendClientMessage(playerid, -1, "Max size: 3 | Min size: 1");
    new Float:x, Float:y, Float:z;
    GetPlayerPos(playerid, x, y, z);
    hInfo[id][HouseID] = id;
    hInfo[id][Size] = size;
    hInfo[id][Price] = HousePrice;
    hInfo[id][Owned] = 0;
    hInfo[id][posX] = x;
    hInfo[id][posY] = y;
    hInfo[id][posZ] = z;
    hInfo[id][VirtualWorld] = GetPlayerVirtualWorld(playerid);
    format(hInfo[id][Owner], 24, "None");
    if(hInfo[id][Size] == 1)
    {
    HouseEnter[id] = CreateDynamicCP(x, y, z, 1.5, GetPlayerVirtualWorld(playerid));
    HouseExit[id] = CreateDynamicCP(2307.7524, -1212.8821, 1049.0234, 1.5, GetPlayerVirtualWorld(playerid), 6);
    Create3DTextLabel("Exit the house", 0xFF0000FF, 2307.7524, -1212.8821, 1049.0234, 25.0, GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid, -1, "Small House created !");
    }
    if(hInfo[id][Size] == 2)
    {
    HouseEnter[id] = CreateDynamicCP(x, y, z, 1.5, GetPlayerVirtualWorld(playerid));
    HouseExit[id] = CreateDynamicCP(2365.2603,-1135.5988,1050.8826, 1.5, GetPlayerVirtualWorld(playerid), 8);
    Create3DTextLabel("Exit the house", 0xFF0000FF, 2365.2603, -1135.5988, 1050.8826, 25.0, GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid, -1, "Medium House created !");
    }
    if(hInfo[id][Size] == 3)
    {
    HouseEnter[id] = CreateDynamicCP(x, y, z, 1.5, GetPlayerVirtualWorld(playerid));
    HouseExit[id] = CreateDynamicCP(2324.4839, -1149.5469, 1050.7101, 1.5, GetPlayerVirtualWorld(playerid), 12);
    Create3DTextLabel("Exit the house", 0xFF0000FF, 2324.4839, -1149.5469, 1050.7101, 25.0, GetPlayerVirtualWorld(playerid));
    SendClientMessage(playerid, -1, "Big House created !");
    }
    new labelstring[300]; new str[100];
    format(str, sizeof(str), "Red_VS_Blue/Houses/%i.ini", id);
    new INI:file = INI_Open(str);
    INI_SetTag(file, "House's Data");
    INI_WriteInt(file, "HouseID", id);
    INI_WriteInt(file, "Size", size);
    INI_WriteInt(file, "Price", HousePrice);
    INI_WriteInt(file, "Owned", 0);
    INI_WriteInt(file, "VirtualWorld", GetPlayerVirtualWorld(playerid));
    INI_WriteFloat(file, "posX", x);
    INI_WriteFloat(file, "posY", y);
    INI_WriteFloat(file, "posZ", z);
    INI_WriteString(file, "Owner", "None");
    INI_Close(file);
    format(labelstring, sizeof(labelstring), "House ID: {FFFFFF}%i\n{008000}Owner: {FFFFFF}None\n{008000}Owned: {FFFFFF}No\n{008000}Price: {FFFFFF}%i\n{008000}Size: {FFFFFF}%i", HouseCount, HousePrice, size);
    hInfo[id][HouseLabel] = Create3DTextLabel(labelstring, 0x008000C8, x, y, z, 25.0, GetPlayerVirtualWorld(playerid));
    HousePickup[id] = CreateDynamicPickup(1273, 1, x, y, z, GetPlayerVirtualWorld(playerid), 0, -1, 500.0);
    HouseIcon[id] = CreateDynamicMapIcon(x, y, z, 31, -1, GetPlayerVirtualWorld(playerid), -1, -1, 500.0);
    HouseCount ++;
    return 1;
}
Reply


Messages In This Thread
[HELP]: House System - by Areax - 13.11.2013, 17:48
Re: [HELP]: House System - by Areax - 13.11.2013, 18:47
Re: [HELP]: House System - by DaniceMcHarley - 13.11.2013, 21:09
Re: [HELP]: House System - by Areax - 14.11.2013, 03:57
Re: [HELP]: House System - by Areax - 14.11.2013, 12:34

Forum Jump:


Users browsing this thread: 5 Guest(s)