Jump to content

[REL] Base API


Soapbosnia

Recommended Posts

Eh, hello. This is just a base api script which I've made 5 minutes ago for my server BalkanRoam.

Syntax:

call(getResourceFromName("base_api"),"create", {
	["CLAN"] = "Avalanche", -- The name of the team which can use the markers / gates.
	["MARKERS"] = {
		{-1456.0411376953, 399.1416015625, 7.1875 + 0.7, -1547.4196777344, 345.00686645508, 53.678123474121},
		{-1548.0695800781, 342.95944213867, 53.678123474121 + 1, -1458.1085205078, 399.03720092773, 7.1875},
		-- 1st 3 arguments are the position of the marker, 2nd 3 arguments are the position where the player should get teleported to.
	},
	["GATES"] = {
		{980, -1357.8365478516, 466.90267944336, 9, 0, 0, 270, 3000, -1357.8365478516, 466.90267944336, 14.45, 'avmain'},
		{10828, -1342.0478515625, 353.2890625, 11.841010093689, 0, 0, 90, 3000, -1342.0478515625, 353.2890625, 2.731010093689, 'avrunway'},
		-- 1st argument is the object ID of the gate, 2nd 3 arguments are the position of the gate, 3rd 3 arguments is the rotation of the gate, 4th 3 arguments are 
		-- the position of the gate when the command gets typed, the last argument is the command name.
	},
}
)

Resource: https://community.multitheftauto.com/index.php?p=resources&s=details&id=16016

Enjoy ;x.

Link to comment
  • 3 weeks later...
Guest    

nice codes and resource

thx for share

 

Spoiler
<meta>
    <info author="Soapbosnia (Salih Muratović)" name="BalkanRoam Base API" version="1.0" type="misc" />
    <oop>true</oop>
    <script src="server.lua" type="server" />
    <export function="create" type="server" />
</meta>

 

 


 
local ST = {}

function create(T)
    local team = T["CLAN"];
    local markers = T["MARKERS"];
    local gates = T["GATES"];
    -- [MARKERS] --
    if markers then
        for i,v in ipairs(markers) do
            local x, y, z = v[1], v[2], v[3];
            local tx, ty, tz = v[4], v[5], v[6];
            local marker = createMarker(x, y, z, "arrow", 1.1, 255, 255, 0, 170);
            addEventHandler("onMarkerHit", marker,
            function(e)
                if e:getType() == "player" then
                    local t = e:getTeam();
                    if t then
                        local name = t:getName();
                        if name == team then
                            e:setPosition(tx, ty, tz, false);
                        else
                            outputChatBox("• You must be a member of #ffffff"..team.."#ff0000 to be able to use this.", e, 255, 0, 0, true);
                        end
                    else
                        outputChatBox("• You must be a member of #ffffff"..team.."#ff0000 to be able to use this.", e, 255, 0, 0, true);
                    end
                end
            end
            );
        end
    end
    -- [GATES] --
    if gates then
        for i,v in ipairs(gates) do
            local i, x, y, z, rx, ry, rz, ms, tx, ty, tz, c = v[1], v[2], v[3], v[4], v[5], v[6], v[7], v[8], v[9], v[10], v[11], v[12];
            local o = createObject(i, x, y, z, rx, ry, rz);
            ST[o] = "Closed";
            addCommandHandler(c,
            function(p, cmd)
                local t = p:getTeam();
                if t then
                    local name = t:getName();
                    if name == team then
                        if ST[o] == "Closed" then
                            moveObject(o, ms, tx, ty, tz);
                            ST[o] = "Open";
                        else
                            moveObject(o, ms, x, y, z);
                            ST[o] = "Closed";
                        end
                    end
                end
            end
            );
        end
    end
end

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...