Jump to content

help


Nerses

Recommended Posts

Can you tell us the error using /debugscript 3

well I have by the way, another question arose not only on this topic. I need a system that would keep the position. and then for example played 5-6 minutes, then left again went and remained at the same old place. What can be?

addEventHandler('onResourceStart',resourceRoot, 
    function (      ) 
        local CreateNewTable = executeSQLQuery ('CREATE TABLE IF NOT EXISTS  `Save Position System` ( PlayerSerial,PlayerX,PlayerY,PlayerZ ) ') 
            if ( CreateNewTable ) then 
                outputDebugString('Create [ Save Position System ] Table done .') 
        end 
    end 
) 
  
addEventHandler('onPlayerQuit',root, 
    function (  ) 
    local x,y,z = getElementPosition ( source ) 
    local Results = executeSQLQuery("SELECT * FROM `Save Position System` WHERE PlayerSerial=?",getPlayerSerial ( source ) ) 
     if ( type ( Results ) == "table" and #Results == 0 or not Results ) then 
        executeSQLQuery ( "INSERT INTO `Save Position System` ( PlayerSerial,PlayerX,PlayerY,PlayerZ ) VALUES(?,?,?,?)",getPlayerSerial ( source ),x,y,z ) 
    else 
        executeSQLQuery('UPDATE `Save Position System` SET PlayerX =?, PlayerY =?, PlayerZ =? WHERE PlayerSerial =?',x,y,z,getPlayerSerial ( source ) ) 
    end 
end 
) 
  
addEventHandler('onPlayerJoin',root, 
    function (  ) 
        local Results = executeSQLQuery("SELECT * FROM `Save Position System` WHERE PlayerSerial=?",getPlayerSerial ( source ) ) 
        if ( type ( Results ) == "table" and #Results == 0 or not Results ) then return end 
            setTimer( setElementPosition,2000,1,source,Results[1]['PlayerX'],Results[1]['PlayerY'],Results[1]['PlayerZ'] ) 
    end 
) 

Use this in a new resource -server side- And it should remember the positions when the player joined again.

WOOOW!)))))

Okay, a couple more questions and I will leave you and the fact that I played :)))))))) Please tell me how to make that Nicky were not colored. Ie comes a man on the server and in him before the nick of a color code, and as for the servers, it turns out that as he goes nick become colour when the conversation in chat. How to fix friend?

Link to comment
  • Replies 72
  • Created
  • Last Reply

Top Posters In This Topic

WOOOW!)))))

Okay, a couple more questions and I will leave you and the fact that I played :)))))))) Please tell me how to make that Nicky were not colored. Ie comes a man on the server and in him before the nick of a color code, and as for the servers, it turns out that as he goes nick become colour when the conversation in chat. How to fix friend?

You mean that you want to remove 'Hex Colors' From players name [Nick] or Show it?

Link to comment

WOOOW!)))))

Okay, a couple more questions and I will leave you and the fact that I played :)))))))) Please tell me how to make that Nicky were not colored. Ie comes a man on the server and in him before the nick of a color code, and as for the servers, it turns out that as he goes nick become colour when the conversation in chat. How to fix friend?

You mean that you want to remove 'Hex Colors' From players name [Nick] or Show it?

Yeeeeess my friend!)

Link to comment
If remove then use
string.gsub 

to remove it.

P.S : Are you using freeroam RES?

again what to delete? I do not understand what for RES?

I mean if you want to remove 'Hex Colors' Which looks like #FFFFFF , That you must use :

string.gsub 

About RES I meant : freeroam resource, That's all.

Link to comment
If remove then use
string.gsub 

to remove it.

P.S : Are you using freeroam RES?

again what to delete? I do not understand what for RES?

I mean if you want to remove 'Hex Colors' Which looks like #FFFFFF , That you must use :

string.gsub 

About RES I meant : freeroam resource, That's all.

But Yes. And how is it used?

Link to comment
If you have freeroam resource then please post this file here : fr_server.lua , So i can take a look
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource())
g_PlayerData = {}
g_VehicleData = {}
local chatTime = {}
local lastChatMessage = {}
 
g_ArmedVehicles = {
    [425] = true,
    [447] = true,
    [520] = true,
    [430] = true,
    [464] = true,
    [432] = true
}
g_Trailers = {
    [606] = true,
    [607] = true,
    [610] = true,
    [590] = true,
    [569] = true,
    [611] = true,
    [584] = true,
    [608] = true,
    [435] = true,
    [450] = true,
    [591] = true
}
 
g_RPCFunctions = {
    addPedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    fadeVehiclePassengersCamera = true,
    fixVehicle = { option = 'repair', descr = 'Repairing vehicles' },
    giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' },
    giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' },
    givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' },
    killPed = { option = 'kill', descr = 'Killing yourself' },
    removePedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    removePedFromVehicle = true,
    removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' },
    removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' },
    setElementPosition = true,
    setElementInterior = true,
    setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' },
    setMySkin = { option = 'setskin', descr = 'Setting skin' },
    setPedAnimation = { option = 'anim', descr = 'Setting an animation' },
    setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' },
    setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' },
    setPedStat = { option = 'stats', descr = 'Changing stats' },
    setTime = { option = 'time.set', descr = 'Changing time' },
    setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' },
    setVehicleColor = true,
    setVehicleHeadLightColor = true,
    setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' },
    setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' },
    setVehicleRotation = true,
    setWeather = { option = 'weather', descr = 'Setting weather' },
    spawnMe = true,
    warpMe = { option = 'warp', descr = 'Warping' }
}
 
g_OptionDefaults = {
    alpha = true,
    anim = true,
    clothes = true,
    createvehicle = true,
    gamespeed = {
        enabled = true,
        min = 0.0,
        max = 3
    },
    gravity = {
        enabled = true,
        min = 0,
        max = 0.1
    },
    jetpack = true,
    kill = true,
    lights = true,
    paintjob = true,
    repair = true,
    setskin = true,
    setstyle = true,
    spawnmaponstart = true,
    spawnmapondeath = true,
    stats = true,
    time = {
        set = true,
        freeze = true
    },
    upgrades = true,
    warp = true,
    weapons = {
        enabled = true,
        vehiclesenabled = true,
        disallowed = {}
    },
    weather = true,
    welcometextonstart = true,
    vehicles = {
        maxidletime = 60000,
        idleexplode = true,
        maxperplayer = 2,
        disallowed = {}
    }
}
 
function getOption(optionName)
    local option = get(optionName:gsub('%.', '/'))
    if option then
        if option == 'true' then
            option = true
        elseif option == 'false' then
            option = false
        end
        return option
    end
    option = g_OptionDefaults
    for i,part in ipairs(optionName:split('.')) do
        option = option[part]
    end
    return option
end
 
addEventHandler('onResourceStart', g_ResRoot,
    function()
        table.each(getElementsByType('player'), joinHandler)
    end
)
 
function joinHandler(player)
    if not player then
        player = source
    end
    local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255)
    setPlayerNametagColor(player, r, g, b)
    g_PlayerData[player] = { vehicles = {} }
    g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b)
    if g_FrozenTime then
        clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather)
    end
    if getOption('welcometextonstart') then
        outputChatBox('Добро пожалывать на БПАН', player, 0, 255, 0)
        outputChatBox('Нажмите F1 для создания автомобиля.', player, 0, 255, 0)
    end
end
addEventHandler('onPlayerJoin', g_Root, joinHandler)
 
addEvent('onLoadedAtClient', true)
addEventHandler('onLoadedAtClient', g_ResRoot,
    function(player)
        if getOption('spawnmaponstart') and isPedDead(player) then
            clientCall(player, 'showWelcomeMap')
        end
    end,
    false
)
 
addEventHandler('onPlayerWasted', g_Root,
    function()
        if not getOption('spawnmapondeath') then
            return
        end
        local player = source
        setTimer(
            function()
                if isPedDead(player) then
                    clientCall(player, 'showMap')
                end
            end,
            2000,
            1
        )
    end
)
 
addEvent('onClothesInit', true)
addEventHandler('onClothesInit', g_Root,
    function()
        local result = {}
        local texture, model
        -- get all clothes
        result.allClothes = {}
        local typeGroup, index
        for type=0,17 do
            typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}}
            table.insert(result.allClothes, typeGroup)
            index = 0
            texture, model = getClothesByTypeIndex(type, index)
            while texture do
                table.insert(typeGroup.children, {id = index, texture = texture, model = model})
                index = index + 1
                texture, model = getClothesByTypeIndex(type, index)
            end
        end
        -- get current player clothes { type = {texture=texture, model=model} }
        result.playerClothes = {}
        for type=0,17 do
            texture, model = getPedClothes(source, type)
            if texture then
                result.playerClothes[type] = {texture = texture, model = model}
            end
        end
        triggerClientEvent(source, 'onClientClothesInit', source, result)
    end
)
 
addEvent('onPlayerGravInit', true)
addEventHandler('onPlayerGravInit', g_Root,
    function()
        triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source))
    end
)
 
function setMySkin(skinid)
    if isPedDead(source) then
        local x, y, z = getElementPosition(source)
        if isPedTerminated(source) then
            x = 0
            y = 0
            z = 3
        end
        local r = getPedRotation(source)
        local interior = getElementInterior(source)
        spawnPlayer(source, x, y, z, r, skinid)
        setElementInterior(source, interior)
        setCameraInterior(source, interior)
    else
        setElementModel(source, skinid)
        setElementHealth(source, 100)
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function spawnMe(x, y, z)
    if not x then
        x, y, z = getElementPosition(source)
    end
    if isPedTerminated(source) then
        repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288))
    else
        spawnPlayer(source, x, y, z, 0, getPedSkin(source))
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function warpMe(targetPlayer)
   
Link to comment
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource())
g_PlayerData = {}
g_VehicleData = {}
local chatTime = {}
local lastChatMessage = {}
 
g_ArmedVehicles = {
    [425] = true,
    [447] = true,
    [520] = true,
    [430] = true,
    [464] = true,
    [432] = true
}
g_Trailers = {
    [606] = true,
    [607] = true,
    [610] = true,
    [590] = true,
    [569] = true,
    [611] = true,
    [584] = true,
    [608] = true,
    [435] = true,
    [450] = true,
    [591] = true
}
 
g_RPCFunctions = {
    addPedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    fadeVehiclePassengersCamera = true,
    fixVehicle = { option = 'repair', descr = 'Repairing vehicles' },
    giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' },
    giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' },
    givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' },
    killPed = { option = 'kill', descr = 'Killing yourself' },
    removePedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    removePedFromVehicle = true,
    removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' },
    removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' },
    setElementPosition = true,
    setElementInterior = true,
    setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' },
    setMySkin = { option = 'setskin', descr = 'Setting skin' },
    setPedAnimation = { option = 'anim', descr = 'Setting an animation' },
    setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' },
    setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' },
    setPedStat = { option = 'stats', descr = 'Changing stats' },
    setTime = { option = 'time.set', descr = 'Changing time' },
    setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' },
    setVehicleColor = true,
    setVehicleHeadLightColor = true,
    setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' },
    setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' },
    setVehicleRotation = true,
    setWeather = { option = 'weather', descr = 'Setting weather' },
    spawnMe = true,
    warpMe = { option = 'warp', descr = 'Warping' }
}
 
g_OptionDefaults = {
    alpha = true,
    anim = true,
    clothes = true,
    createvehicle = true,
    gamespeed = {
        enabled = true,
        min = 0.0,
        max = 3
    },
    gravity = {
        enabled = true,
        min = 0,
        max = 0.1
    },
    jetpack = true,
    kill = true,
    lights = true,
    paintjob = true,
    repair = true,
    setskin = true,
    setstyle = true,
    spawnmaponstart = true,
    spawnmapondeath = true,
    stats = true,
    time = {
        set = true,
        freeze = true
    },
    upgrades = true,
    warp = true,
    weapons = {
        enabled = true,
        vehiclesenabled = true,
        disallowed = {}
    },
    weather = true,
    welcometextonstart = true,
    vehicles = {
        maxidletime = 60000,
        idleexplode = true,
        maxperplayer = 2,
        disallowed = {}
    }
}
 
function getOption(optionName)
    local option = get(optionName:gsub('%.', '/'))
    if option then
        if option == 'true' then
            option = true
        elseif option == 'false' then
            option = false
        end
        return option
    end
    option = g_OptionDefaults
    for i,part in ipairs(optionName:split('.')) do
        option = option[part]
    end
    return option
end
 
addEventHandler('onResourceStart', g_ResRoot,
    function()
        table.each(getElementsByType('player'), joinHandler)
    end
)
 
function joinHandler(player)
    if not player then
        player = source
    end
    local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255)
    setPlayerNametagColor(player, r, g, b)
    g_PlayerData[player] = { vehicles = {} }
    g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b)
    if g_FrozenTime then
        clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather)
    end
    if getOption('welcometextonstart') then
        outputChatBox('Добро пожалывать на БПАН', player, 0, 255, 0)
        outputChatBox('Нажмите F1 для создания автомобиля.', player, 0, 255, 0)
    end
end
addEventHandler('onPlayerJoin', g_Root, joinHandler)
 
addEvent('onLoadedAtClient', true)
addEventHandler('onLoadedAtClient', g_ResRoot,
    function(player)
        if getOption('spawnmaponstart') and isPedDead(player) then
            clientCall(player, 'showWelcomeMap')
        end
    end,
    false
)
 
addEventHandler('onPlayerWasted', g_Root,
    function()
        if not getOption('spawnmapondeath') then
            return
        end
        local player = source
        setTimer(
            function()
                if isPedDead(player) then
                    clientCall(player, 'showMap')
                end
            end,
            2000,
            1
        )
    end
)
 
addEvent('onClothesInit', true)
addEventHandler('onClothesInit', g_Root,
    function()
        local result = {}
        local texture, model
        -- get all clothes
        result.allClothes = {}
        local typeGroup, index
        for type=0,17 do
            typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}}
            table.insert(result.allClothes, typeGroup)
            index = 0
            texture, model = getClothesByTypeIndex(type, index)
            while texture do
                table.insert(typeGroup.children, {id = index, texture = texture, model = model})
                index = index + 1
                texture, model = getClothesByTypeIndex(type, index)
            end
        end
        -- get current player clothes { type = {texture=texture, model=model} }
        result.playerClothes = {}
        for type=0,17 do
            texture, model = getPedClothes(source, type)
            if texture then
                result.playerClothes[type] = {texture = texture, model = model}
            end
        end
        triggerClientEvent(source, 'onClientClothesInit', source, result)
    end
)
 
addEvent('onPlayerGravInit', true)
addEventHandler('onPlayerGravInit', g_Root,
    function()
        triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source))
    end
)
 
function setMySkin(skinid)
    if isPedDead(source) then
        local x, y, z = getElementPosition(source)
        if isPedTerminated(source) then
            x = 0
            y = 0
            z = 3
        end
        local r = getPedRotation(source)
        local interior = getElementInterior(source)
        spawnPlayer(source, x, y, z, r, skinid)
        setElementInterior(source, interior)
        setCameraInterior(source, interior)
    else
        setElementModel(source, skinid)
        setElementHealth(source, 100)
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function spawnMe(x, y, z)
    if not x then
        x, y, z = getElementPosition(source)
    end
    if isPedTerminated(source) then
        repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288))
    else
        spawnPlayer(source, x, y, z, 0, getPedSkin(source))
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function warpMe(targetPlayer)
   
Link to comment
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource())
g_PlayerData = {}
g_VehicleData = {}
local chatTime = {}
local lastChatMessage = {}
 
g_ArmedVehicles = {
    [425] = true,
    [447] = true,
    [520] = true,
    [430] = true,
    [464] = true,
    [432] = true
}
g_Trailers = {
    [606] = true,
    [607] = true,
    [610] = true,
    [590] = true,
    [569] = true,
    [611] = true,
    [584] = true,
    [608] = true,
    [435] = true,
    [450] = true,
    [591] = true
}
 
g_RPCFunctions = {
    addPedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    fadeVehiclePassengersCamera = true,
    fixVehicle = { option = 'repair', descr = 'Repairing vehicles' },
    giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' },
    giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' },
    givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' },
    killPed = { option = 'kill', descr = 'Killing yourself' },
    removePedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    removePedFromVehicle = true,
    removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' },
    removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' },
    setElementPosition = true,
    setElementInterior = true,
    setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' },
    setMySkin = { option = 'setskin', descr = 'Setting skin' },
    setPedAnimation = { option = 'anim', descr = 'Setting an animation' },
    setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' },
    setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' },
    setPedStat = { option = 'stats', descr = 'Changing stats' },
    setTime = { option = 'time.set', descr = 'Changing time' },
    setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' },
    setVehicleColor = true,
    setVehicleHeadLightColor = true,
    setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' },
    setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' },
    setVehicleRotation = true,
    setWeather = { option = 'weather', descr = 'Setting weather' },
    spawnMe = true,
    warpMe = { option = 'warp', descr = 'Warping' }
}
 
g_OptionDefaults = {
    alpha = true,
    anim = true,
    clothes = true,
    createvehicle = true,
    gamespeed = {
        enabled = true,
        min = 0.0,
        max = 3
    },
    gravity = {
        enabled = true,
        min = 0,
        max = 0.1
    },
    jetpack = true,
    kill = true,
    lights = true,
    paintjob = true,
    repair = true,
    setskin = true,
    setstyle = true,
    spawnmaponstart = true,
    spawnmapondeath = true,
    stats = true,
    time = {
        set = true,
        freeze = true
    },
    upgrades = true,
    warp = true,
    weapons = {
        enabled = true,
        vehiclesenabled = true,
        disallowed = {}
    },
    weather = true,
    welcometextonstart = true,
    vehicles = {
        maxidletime = 60000,
        idleexplode = true,
        maxperplayer = 2,
        disallowed = {}
    }
}
 
function getOption(optionName)
    local option = get(optionName:gsub('%.', '/'))
    if option then
        if option == 'true' then
            option = true
        elseif option == 'false' then
            option = false
        end
        return option
    end
    option = g_OptionDefaults
    for i,part in ipairs(optionName:split('.')) do
        option = option[part]
    end
    return option
end
 
addEventHandler('onResourceStart', g_ResRoot,
    function()
        table.each(getElementsByType('player'), joinHandler)
    end
)
 
function joinHandler(player)
    if not player then
        player = source
    end
    local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255)
    setPlayerNametagColor(player, r, g, b)
    g_PlayerData[player] = { vehicles = {} }
    g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b)
    if g_FrozenTime then
        clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather)
    end
    if getOption('welcometextonstart') then
        outputChatBox('Добро пожалывать на БПАН', player, 0, 255, 0)
        outputChatBox('Нажмите F1 для создания автомобиля.', player, 0, 255, 0)
    end
end
addEventHandler('onPlayerJoin', g_Root, joinHandler)
 
addEvent('onLoadedAtClient', true)
addEventHandler('onLoadedAtClient', g_ResRoot,
    function(player)
        if getOption('spawnmaponstart') and isPedDead(player) then
            clientCall(player, 'showWelcomeMap')
        end
    end,
    false
)
 
addEventHandler('onPlayerWasted', g_Root,
    function()
        if not getOption('spawnmapondeath') then
            return
        end
        local player = source
        setTimer(
            function()
                if isPedDead(player) then
                    clientCall(player, 'showMap')
                end
            end,
            2000,
            1
        )
    end
)
 
addEvent('onClothesInit', true)
addEventHandler('onClothesInit', g_Root,
    function()
        local result = {}
        local texture, model
        -- get all clothes
        result.allClothes = {}
        local typeGroup, index
        for type=0,17 do
            typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}}
            table.insert(result.allClothes, typeGroup)
            index = 0
            texture, model = getClothesByTypeIndex(type, index)
            while texture do
                table.insert(typeGroup.children, {id = index, texture = texture, model = model})
                index = index + 1
                texture, model = getClothesByTypeIndex(type, index)
            end
        end
        -- get current player clothes { type = {texture=texture, model=model} }
        result.playerClothes = {}
        for type=0,17 do
            texture, model = getPedClothes(source, type)
            if texture then
                result.playerClothes[type] = {texture = texture, model = model}
            end
        end
        triggerClientEvent(source, 'onClientClothesInit', source, result)
    end
)
 
addEvent('onPlayerGravInit', true)
addEventHandler('onPlayerGravInit', g_Root,
    function()
        triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source))
    end
)
 
function setMySkin(skinid)
    if isPedDead(source) then
        local x, y, z = getElementPosition(source)
        if isPedTerminated(source) then
            x = 0
            y = 0
            z = 3
        end
        local r = getPedRotation(source)
        local interior = getElementInterior(source)
        spawnPlayer(source, x, y, z, r, skinid)
        setElementInterior(source, interior)
        setCameraInterior(source, interior)
    else
        setElementModel(source, skinid)
        setElementHealth(source, 100)
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function spawnMe(x, y, z)
    if not x then
        x, y, z = getElementPosition(source)
    end
    if isPedTerminated(source) then
        repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288))
    else
        spawnPlayer(source, x, y, z, 0, getPedSkin(source))
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
Link to comment
g_Root = getRootElement() 
g_ResRoot = getResourceRootElement(getThisResource())
g_PlayerData = {}
g_VehicleData = {}
local chatTime = {}
local lastChatMessage = {}
 
g_ArmedVehicles = {
    [425] = true,
    [447] = true,
    [520] = true,
    [430] = true,
    [464] = true,
    [432] = true
}
g_Trailers = {
    [606] = true,
    [607] = true,
    [610] = true,
    [590] = true,
    [569] = true,
    [611] = true,
    [584] = true,
    [608] = true,
    [435] = true,
    [450] = true,
    [591] = true
}
 
g_RPCFunctions = {
    addPedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    addVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    fadeVehiclePassengersCamera = true,
    fixVehicle = { option = 'repair', descr = 'Repairing vehicles' },
    giveMeVehicles = { option = 'createvehicle', descr = 'Creating vehicles' },
    giveMeWeapon = { option = 'weapons.enabled', descr = 'Getting weapons' },
    givePedJetPack = { option = 'jetpack', descr = 'Getting a jetpack' },
    killPed = { option = 'kill', descr = 'Killing yourself' },
    removePedClothes = { option = 'clothes', descr = 'Modifying clothes' },
    removePedFromVehicle = true,
    removePedJetPack = { option = 'jetpack', descr = 'Removing a jetpack' },
    removeVehicleUpgrade = { option = 'upgrades', descr = 'Adding/removing upgrades' },
    setElementAlpha = { option = 'alpha', descr = 'Changing your alpha' },
    setElementPosition = true,
    setElementInterior = true,
    setMyGameSpeed = { option = 'gamespeed.enabled', descr = 'Setting game speed' },
    setMySkin = { option = 'setskin', descr = 'Setting skin' },
    setPedAnimation = { option = 'anim', descr = 'Setting an animation' },
    setPedFightingStyle = { option = 'setstyle', descr = 'Setting fighting style' },
    setPedGravity = { option = 'gravity.enabled', descr = 'Setting gravity' },
    setPedStat = { option = 'stats', descr = 'Changing stats' },
    setTime = { option = 'time.set', descr = 'Changing time' },
    setTimeFrozen = { option = 'time.freeze', descr = 'Freezing time' },
    setVehicleColor = true,
    setVehicleHeadLightColor = true,
    setVehicleOverrideLights = { option = 'lights', descr = 'Forcing lights' },
    setVehiclePaintjob = { option = 'paintjob', descr = 'Applying paintjobs' },
    setVehicleRotation = true,
    setWeather = { option = 'weather', descr = 'Setting weather' },
    spawnMe = true,
    warpMe = { option = 'warp', descr = 'Warping' }
}
 
g_OptionDefaults = {
    alpha = true,
    anim = true,
    clothes = true,
    createvehicle = true,
    gamespeed = {
        enabled = true,
        min = 0.0,
        max = 3
    },
    gravity = {
        enabled = true,
        min = 0,
        max = 0.1
    },
    jetpack = true,
    kill = true,
    lights = true,
    paintjob = true,
    repair = true,
    setskin = true,
    setstyle = true,
    spawnmaponstart = true,
    spawnmapondeath = true,
    stats = true,
    time = {
        set = true,
        freeze = true
    },
    upgrades = true,
    warp = true,
    weapons = {
        enabled = true,
        vehiclesenabled = true,
        disallowed = {}
    },
    weather = true,
    welcometextonstart = true,
    vehicles = {
        maxidletime = 60000,
        idleexplode = true,
        maxperplayer = 2,
        disallowed = {}
    }
}
 
function getOption(optionName)
    local option = get(optionName:gsub('%.', '/'))
    if option then
        if option == 'true' then
            option = true
        elseif option == 'false' then
            option = false
        end
        return option
    end
    option = g_OptionDefaults
    for i,part in ipairs(optionName:split('.')) do
        option = option[part]
    end
    return option
end
 
addEventHandler('onResourceStart', g_ResRoot,
    function()
        table.each(getElementsByType('player'), joinHandler)
    end
)
 
function joinHandler(player)
    if not player then
        player = source
    end
    local r, g, b = math.random(50, 255), math.random(50, 255), math.random(50, 255)
    setPlayerNametagColor(player, r, g, b)
    g_PlayerData[player] = { vehicles = {} }
    g_PlayerData[player].blip = createBlipAttachedTo(player, 0, 2, r, g, b)
    if g_FrozenTime then
        clientCall(player, 'setTimeFrozen', true, g_FrozenTime[1], g_FrozenTime[2], g_FrozenWeather)
    end
    if getOption('welcometextonstart') then
        outputChatBox('Добро пожалывать на БПАН', player, 0, 255, 0)
        outputChatBox('Нажмите F1 для создания автомобиля.', player, 0, 255, 0)
    end
end
addEventHandler('onPlayerJoin', g_Root, joinHandler)
 
addEvent('onLoadedAtClient', true)
addEventHandler('onLoadedAtClient', g_ResRoot,
    function(player)
        if getOption('spawnmaponstart') and isPedDead(player) then
            clientCall(player, 'showWelcomeMap')
        end
    end,
    false
)
 
addEventHandler('onPlayerWasted', g_Root,
    function()
        if not getOption('spawnmapondeath') then
            return
        end
        local player = source
        setTimer(
            function()
                if isPedDead(player) then
                    clientCall(player, 'showMap')
                end
            end,
            2000,
            1
        )
    end
)
 
addEvent('onClothesInit', true)
addEventHandler('onClothesInit', g_Root,
    function()
        local result = {}
        local texture, model
        -- get all clothes
        result.allClothes = {}
        local typeGroup, index
        for type=0,17 do
            typeGroup = {'group', type = type, name = getClothesTypeName(type), children = {}}
            table.insert(result.allClothes, typeGroup)
            index = 0
            texture, model = getClothesByTypeIndex(type, index)
            while texture do
                table.insert(typeGroup.children, {id = index, texture = texture, model = model})
                index = index + 1
                texture, model = getClothesByTypeIndex(type, index)
            end
        end
        -- get current player clothes { type = {texture=texture, model=model} }
        result.playerClothes = {}
        for type=0,17 do
            texture, model = getPedClothes(source, type)
            if texture then
                result.playerClothes[type] = {texture = texture, model = model}
            end
        end
        triggerClientEvent(source, 'onClientClothesInit', source, result)
    end
)
 
addEvent('onPlayerGravInit', true)
addEventHandler('onPlayerGravInit', g_Root,
    function()
        triggerClientEvent('onClientPlayerGravInit', source, getPedGravity(source))
    end
)
 
function setMySkin(skinid)
    if isPedDead(source) then
        local x, y, z = getElementPosition(source)
        if isPedTerminated(source) then
            x = 0
            y = 0
            z = 3
        end
        local r = getPedRotation(source)
        local interior = getElementInterior(source)
        spawnPlayer(source, x, y, z, r, skinid)
        setElementInterior(source, interior)
        setCameraInterior(source, interior)
    else
        setElementModel(source, skinid)
        setElementHealth(source, 100)
    end
    setCameraTarget(source, source)
    setCameraInterior(source, getElementInterior(source))
end
 
function spawnMe(x, y, z)
    if not x then
        x, y, z = getElementPosition(source)
    end
    if isPedTerminated(source) then
        repeat until spawnPlayer(source, x, y, z, 0, math.random(9, 288))
    else
        spawnPlayer(source, x, y, z, 0, getPedSkin(source))
    end
   
Link to comment
You can use this which has weapons shop and restaurants : Here .

Otherwise :

I think this should be enough to open a classic restaurant :

setElementInterior
createMarker
getElementType
'onMarkerHit'

how to enable it? I uploaded put on startup and nothing...

Link to comment
<help>Mabako services version 2.4.0 
made originally by mabako on older versions, patched and improved to make it work on MTA SA 1.0 or newer, and 1.1 onwards by XX3. 
  
If you don't understand how this works, here's some tutorial: 
To get food, go to the burger, pizza or cluckin bell blip. (it will appear if you are close enough to the building) Go to the counter and choose one of these food. It will restore some health in one click. 
  
To get weapons, go to the ammunation blip, go to the counter and buy each of the weapons included by going to the counter. 
  
Jetpacks can be used/removed by pressing "J" (If you got freeroam resource loaded, it will run 2 times at once if you pressed J, so you wouldn`t see the jetpack. Solution: Change the bind key) 
Jetpacks have fuels, and can be refueled through ammu-nation. Use the jetpack wisely, so you don't run out of fuel in the air. 
  
For owners: 
You can edit the price, available weapons, ammo included per buy,  locations of pay'n'spray, in the maps folder. 
</help> 

Link to comment
<help>Mabako services version 2.4.0 
made originally by mabako on older versions, patched and improved to make it work on MTA SA 1.0 or newer, and 1.1 onwards by XX3. 
  
If you don't understand how this works, here's some tutorial: 
To get food, go to the burger, pizza or cluckin bell blip. (it will appear if you are close enough to the building) Go to the counter and choose one of these food. It will restore some health in one click. 
  
To get weapons, go to the ammunation blip, go to the counter and buy each of the weapons included by going to the counter. 
  
Jetpacks can be used/removed by pressing "J" (If you got freeroam resource loaded, it will run 2 times at once if you pressed J, so you wouldn`t see the jetpack. Solution: Change the bind key) 
Jetpacks have fuels, and can be refueled through ammu-nation. Use the jetpack wisely, so you don't run out of fuel in the air. 
  
For owners: 
You can edit the price, available weapons, ammo included per buy,  locations of pay'n'spray, in the maps folder. 
</help> 

not understood. As there is more to remove jetpack?

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...