Jump to content

[HELP] BasicRP


Recommended Posts

It's difficult to understand you. Map files contain data that are present on the server (some are physical, some are just data holders). You can use many types of elements in the map. This is a list of some of the elements you may create:

<object ... /> 
<marker ... /> 
<colrectangle ... /> 
<vehicle ... /> 
etc. 

You can check the types of elements on the wiki. If you open a createMarker wiki page you'll see the value it returns is "marker" (highlighted in green), when you click that it will take you to the page explaining what attributes are supported. Some gamemodes may have their own typed, like eg. race gamemode, it supports and .

You can create maps in the Map Editor and once you save the map you will find the .map file with all the elements you created in Map Editor.

Link to comment
Map editor, then save the map with no spaces, then the file will be saved in your resource folder. It should then contain some lines of script.

I am trying to figure out what am I supposed to put in vehicles.map because I don't know

but look here these are the files it came with the script:

s_police.lua:

--[[ 
    Basic Roleplay Gamemode
    ~ Server-side functions for the police
   
    Created by Socialz
]]--
 
-- Miniatures
local cRoot = getRootElement()
local cThis = getThisResource()
local cThisRoot = getResourceRootElement(cThis)
 
-- Configurations (modifyable)
local jails = {
    -- ID : x position, y position, z position, interior, dimension, radius
    [1] = {1849.47, -1453.7, 13.39, 0, 0, 5}
}
 
-- Releasepoint's x, y, z, interior and dimension positions
local releasepoint_x = 0
local releasepoint_y = 0
local releasepoint_z = 0
local releasepoint_interior = 0
local releasepoint_dimension = 0
 
-- Functions
local addCommandHandler_ = addCommandHandler
      addCommandHandler  = function(commandName, fn, restricted, caseSensitive)
    if type(commandName) ~= "table" then
        commandName = {commandName}
    end
    for key, value in ipairs(commandName) do
        if key == 1 then
            addCommandHandler_(value, fn, restricted, caseSensitive)
        else
            addCommandHandler_(value,
                function(player, ...)
                    fn(player, ...)
                end
            )
        end
    end
end
 
-- ~ [CUFF, HANDCUFF, RESTRAIN] ~ --
addCommandHandler({"cuff", "handcuff", "restrain"},
    function(player, cmd, name)
        for i,v in ipairs(getElementsByType("ped")) do
            if tonumber(getElementData(player, "factions.player")) == tonumber(getElementData(v, "factions.id")) then
                if exports.brpExports:getFactionType(v) == "law" then
                    if name then
                        local target = exports.brpExports:findPlayer(name, player)
                        if target then
                            if player ~= target then
                                local x, y, z = getElementPosition(player)
                                if exports.brpExports:isElementInRangeOfPoint(target, x, y, z, 5) then
                                    if not getElementData(target, "police.cuffed") then
                                        toggleControl(target, "fire", false)
                                        toggleControl(target, "next_weapon", false)
                                        toggleControl(target, "previous_weapon", false)
                                        toggleControl(target, "sprint", false)
                                        toggleControl(target, "aim_weapon", false)
                                        toggleControl(target, "handbrake", false)
                                        toggleControl(target, "vehicle_fire", false)
                                        toggleControl(target, "vehicle_secondary_fire", false)
                                        toggleControl(target, "vehicle_left", false)
                                        toggleControl(target, "vehicle_right", false)
                                        toggleControl(target, "steer_forward", false)
                                        toggleControl(target, "steer_back", false)
                                        setElementData(target, "police.cuffed", true)
                                        outputChatBox("You are now restraining " .. getPlayerName(target) .. ".", player, 255, 255, 255, false)
                                        outputChatBox("You are now restrained by " .. getPlayerName(target) .. ".", target, 255, 255, 255, false)
                                        outputServerLog("[FACTIONS] [CMD/CUFF]: " .. getPlayerName(player) .. " is now restraining " .. getPlayerName(target) .. ".")
                                    else
                                        outputChatBox("That player is already handcuffed.", player, 255, 0, 0, false)
                                    end
                                else
                                    outputChatBox("You are too far from the target.", player, 255, 0, 0, false)
                                end
                            else
                                outputChatBox("You cannot cuff yourself.", player, 255, 0, 0, false)
                            end
                        else
                            outputChatBox("Couldn't find such player.", player, 255, 0, 0, false)
                        end
                    else
                        outputChatBox("Syntax: /" .. cmd .. " ", player, 220, 220, 0, false)
                    end
                end
            end
        end
    end
)
 
-- ~ [uNCUFF, UNHANDCUFF, UNRESTRAIN] ~ --
addCommandHandler({"uncuff", "unhandcuff", "unrestrain"},
    function(player, cmd, name)
        for i,v in ipairs(getElementsByType("ped")) do
            if tonumber(getElementData(player, "factions.player")) == tonumber(getElementData(v, "factions.id")) then
                if exports.brpExports:getFactionType(v) == "law" then
                    if name then
                        local target = exports.brpExports:findPlayer(name, player)
                        if target then
                            if player ~= target then
                                local x, y, z = getElementPosition(player)
                                if exports.brpExports:isElementInRangeOfPoint(target, x, y, z, 5) then
                                    if getElementData(target, "police.cuffed") then
                                        toggleControl(target, "fire", true)
                                        toggleControl(target, "next_weapon", true)
                                        toggleControl(target, "previous_weapon", true)
                                        toggleControl(target, "sprint", true)
                                        toggleControl(target, "aim_weapon", true)
                                        toggleControl(target, "handbrake", true)
                                        toggleControl(target, "vehicle_fire", true)
                                        toggleControl(target, "vehicle_secondary_fire", true)
                                        toggleControl(target, "vehicle_left", true)
                                        toggleControl(target, "vehicle_right", true)
                                        toggleControl(target, "steer_forward", true)
                                        toggleControl(target, "steer_back", true)
                                        removeElementData(target, "police.cuffed")
                                        outputChatBox("You unrestrained " .. getPlayerName(target) .. ".", player, 255, 255, 255, false)
                                        outputChatBox("You are unrestrained by " .. getPlayerName(target) .. ".", target, 255, 255, 255, false)
                                        outputServerLog("[FACTIONS] [CMD/UNCUFF]: " .. getPlayerName(player) .. " now unrestrained " .. getPlayerName(target) .. ".")
                                    else
                                        outputChatBox("That player is not handcuffed.", player, 255, 0, 0, false)
                                    end
                                else
                                    outputChatBox("You are too far from the target.", player, 255, 0, 0, false)
                                end
                            else
                                outputChatBox("You cannot uncuff yourself.", player, 255, 0, 0, false)
                            end
                        else
                            outputChatBox("Couldn't find such player.", player, 255, 0, 0, false)
                        end
                    else
                        outputChatBox("Syntax: /" .. cmd .. " ", player, 220, 220, 0, false)
                    end
                end
            end
        end
    end
)
 
-- ~ [AUNCUFF, AUNHANDCUFF, AUNRESTRAIN] ~ --
addCommandHandler({"auncuff", "aunhandcuff", "aunrestrain"},
    function(player, cmd, name)
        if exports.brpExports:isPlayerAdmin(player) then
            if name then
                local target = exports.brpExports:findPlayer(name, player)
                if target then
                    if getElementData(target, "police.cuffed") then
                        toggleControl(target, "fire", true)
                        toggleControl(target, "next_weapon", true)
                        toggleControl(target, "previous_weapon", true)
                        toggleControl(target, "sprint", true)
                        toggleControl(target, "aim_weapon", true)
                        toggleControl(target, "handbrake", true)
                        toggleControl(target, "vehicle_fire", true)
                        toggleControl(target, "vehicle_secondary_fire", true)
                        toggleControl(target, "vehicle_left", true)
                        toggleControl(target, "vehicle_right", true)
                        toggleControl(target, "steer_forward", true)
                        toggleControl(target, "steer_back", true)
                        removeElementData(target, "police.cuffed")
                        outputChatBox("You unrestrained " .. getPlayerName(target) .. ".", player, 255, 255, 255, false)
                        outputChatBox("You are unrestrained by " .. getPlayerName(target) .. ".", target, 255, 255, 255, false)
                        outputServerLog("[FACTIONS] [CMD/UNCUFF]: " .. getPlayerName(player) .. " now unrestrained " .. getPlayerName(target) .. ".")
                    else
                        outputChatBox("That player is not handcuffed.", player, 255, 0, 0, false)
                    end
                else
                    outputChatBox("Couldn't find such player.", player, 255, 0, 0, false)
                end
            else
                outputChatBox("Syntax: /" .. cmd .. " ", player, 220, 220, 0, false)
            end
        end
    end
)
 
addCommandHandler({"jail", "arrest"},
    function(player, cmd, name, time, fine, ...)
        for i,v in ipairs(getElementsByType("ped")) do
            if tonumber(getElementData(player, "factions.player")) == tonumber(getElementData(v, "factions.id")) then
                if exports.brpExports:getFactionType(v) == "law" then
                    local time = tonumber(time)
                    local fine = tonumber(fine)
                    if name and time and fine and (...) then
                        if time > 0 and time <= 180 and fine >= 0 and fine <= 20000 then
                            local reason = table.concat({ ... }, " ")
                            if #reason > 0 then
                                local target = exports.brpExports:findPlayer(name, player)
                                if target then
                                    --if player ~= target then
                                        local x, y, z = getElementPosition(player)
                                        if exports.brpExports:isElementInRangeOfPoint(target, x, y, z, 5) then
                                            if not getElementData(target, "police.arrested") then
                                                for index,jail in ipairs(jails) do
                                                    if exports.brpExports:isElementInRangeOfPoint(player, jails[index][1], jails[index][2], jails[index][3], jails[index][6]) and getElementInterior(player, jails[index][4]) and getElementDimension(player, jails[index][5]) and exports.brpExports:isElementInRangeOfPoint(target, jails[index][1], jails[index][2], jails[index][3], jails[index][6]) and getElementInterior(target, jails[index][4]) and getElementDimension(target, jails[index][5]) then
                                                        setElementPosition(target, jails[index][1], jails[index][2], jails[index][3])
                                                        setElementInterior(target, jails[index][4])
                                                        setElementDimension(target, jails[index][5])
                                                        outputChatBox("You arrested " .. getPlayerName(target) .. " for " .. time .. " minutes and fined for $" .. fine .. ".", player, 120, 120, 255, false)
                                                        outputChatBox("You were arrested by " .. getPlayerName(player) .. " for " .. time .. " minutes and fined for $" .. fine .. ".", target, 120, 120, 255, false)
                                                        outputServerLog("[FACTIONS] [CMD/JAIL]: " .. getPlayerName(player) .. " arrested " .. getPlayerName(target) .. " for " .. time .. " minutes and fined for $" .. fine .. ".")
                                                        setElementData(target, "police.arrested", true)
                                                       
                                                        if getElementData(target, "police.cuffed") then
                                                            toggleControl(target, "fire", true)
                                                            toggleControl(target, "next_weapon", true)
                                                            toggleControl(target, "previous_weapon", true)
                                                            toggleControl(target, "sprint", true)
                                                            toggleControl(target, "aim_weapon", true)
                                                            toggleControl(target, "handbrake", true)
                                                            toggleControl(target, "vehicle_fire", true)
                                                            toggleControl(target, "vehicle_secondary_fire", true)
                                                            toggleControl(target, "vehicle_left", true)
                                                            toggleControl(target, "vehicle_right", true)
                                                            toggleControl(target, "steer_forward", true)
                                                            toggleControl(target, "steer_back", true)
                                                            removeElementData(target, "police.cuffed")
                                                        end
                                                       
                                                        jailed = setTimer(function(target)
                                                            if getElementData(target, "police.arrested") then
                                                                setElementPosition(target, releasepoint_x, releasepoint_y, releasepoint_z)
                                                                setElementInterior(target, releasepoint_interior)
                                                                setElementDimension(target, releasepoint_dimension)
                                                                outputChatBox("Your time has been served - behave from now on.", target, 120, 120, 255, false)
                                                                outputServerLog("[FACTIONS] [AUTO/RELEASE]: " .. getPlayerName(target) .. " was released from jail automatically.")
                                                                removeElementData(target, "police.arrested")
                                                            end
                                                        end, time * 60000, 1, target)
                                                    end
                                                end
                                            else
                                                outputChatBox("That player is already arrested.", player, 255, 0, 0, false)
                                            end
                                        else
                                            outputChatBox("You are too far from the target.", player, 255, 0, 0, false)
                                        end
                                    --else
                                    --  outputChatBox("You cannot arrest yourself.", player, 255, 0, 0, false)
                                    --end
                                else
                                    outputChatBox("Couldn't find such player.", player, 255, 0, 0, false)
                                end
                            else
                                outputChatBox("Syntax: /" .. cmd .. "
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...