Ejemplo n.º 1
0
        void OnBuild(int playerid, int x, int y, int z)
        {
            int permissionblock = m.GetBlockId("BuildPermission0");

            //can't build any block in column
            for (int zz = 0; zz < m.GetMapSizeZ(); zz++)
            {
                if (zz == z)
                {
                    continue;
                }
                for (int i = 0; i < PermissionLevelsCount; i++)
                {
                    if (m.GetBlock(x, y, zz) == permissionblock + i)
                    {
                        m.SetBlock(x, y, z, 0);
                        m.SendMessage(playerid, "You can't build in a column that contains permission block.");
                        return;
                    }
                }
            }

            //add area
            for (int i = 0; i < PermissionLevelsCount; i++)
            {
                if (m.GetBlock(x, y, z) == permissionblock + i)
                {
                    if (m.GetPlayerPermissionLevel(playerid) <= i)
                    {
                        m.SendMessage(playerid, "No permission");
                        m.SetBlock(x, y, z, 0);
                        return;
                    }
                    m.AddPermissionArea(x - AreaSize, y - AreaSize, 0, x + AreaSize, y + AreaSize, m.GetMapSizeZ(), i);
                }
            }
        }