Jump to content

Help!


frosbite

Recommended Posts

Vehicles.xml!

type="vehicle"> 
    "Aircraft"> 
        "Helicopters"> 
            "548" name="Cargobob" /> 
            "425" name="Hunter" /> 
            "417" name="Leviathan" /> 
            "487" name="Maverick" /> 
            "488" name="News Chopper" /> 
            "497" name="Police Maverick" /> 
            "563" name="Raindance" /> 
            "447" name="Seasparrow" /> 
            "469" name="Sparrow" /> 
        
        "Planes, Jets and Airlines"> 
            "592" name="Andromada" /> 
            "577" name="AT-400" /> 
            "511" name="Beagle" /> 
            "512" name="Cropduster" /> 
            "593" name="Dodo" /> 
            "520" name="Hydra" /> 
            "553" name="Nevada" /> 
            "476" name="Rustler" /> 
            "519" name="Shamal" /> 
            "460" name="Skimmer" /> 
            "513" name="Stuntplane" /> 
        
    
    "Bikes"> 
        "Motorbikes"> 
            "581" name="BF-400" /> 
            "462" name="Faggio" /> 
            "521" name="FCR-900" /> 
            "463" name="Freeway" /> 
            "523" name="HPV1000" /> 
            "522" name="NRG-500" /> 
            "461" name="PCJ-600" /> 
            "448" name="Pizza Boy" /> 
            "468" name="Sanchez" /> 
            "586" name="Wayfarer" /> 
            "471" name="Quadbike" /> 
        
        "Bicycles"> 
            "509" name="Bike" /> 
            "481" name="BMX" /> 
            "510" name="Mountain bike" /> 
        
    
    "Boats"> 
        "472" name="Coastguard" /> 
        "473" name="Dinghy" /> 
        "493" name="Jetmax" /> 
        "595" name="Launch" /> 
        "484" name="Marquis" /> 
        "430" name="Predator" /> 
        "453" name="Reefer" /> 
        "452" name="Speeder" /> 
        "446" name="Squalo" /> 
        "454" name="Tropic" /> 
    
    "Cars"> 
        "Sports Cars"> 
            "602" name="Alpha" /> 
            "429" name="Banshee" /> 
            "402" name="Buffalo" /> 
            "541" name="Bullet" /> 
            "415" name="Cheetah" /> 
            "480" name="Comet" /> 
            "562" name="Elegy" /> 
            "587" name="Euros" /> 
            "565" name="Flash" /> 
            "411" name="Infernus" /> 
            "559" name="Jester" /> 
            "603" name="Phoenix" /> 
            "560" name="Sultan" /> 
            "506" name="Super GT" /> 
            "451" name="Turismo" /> 
            "558" name="Uranus" /> 
            "555" name="Windsor" /> 
            "477" name="ZR-350" /> 
        
        "Lowriders"> 
            "536" name="Blade" /> 
            "575" name="Broadway" /> 
            "518" name="Buccaneer" /> 
            "419" name="Esperanto" /> 
            "534" name="Remington" /> 
            "567" name="Savanna" /> 
            "535" name="Slamvan" /> 
            "576" name="Tornado" /> 
            "412" name="Voodoo" /> 
        
        "2-Door"> 
            "496" name="Blista Compact" /> 
            "401" name="Bravura" /> 
            "527" name="Cadrona" /> 
            "542" name="Clover" /> 
            "533" name="Feltzer" /> 
            "526" name="Fortune" /> 
            "474" name="Hermes" /> 
            "545" name="Hustler" /> 
            "517" name="Majestic" /> 
            "410" name="Manana" /> 
            "436" name="Previon" /> 
            "475" name="Sabre" /> 
            "439" name="Stallion" /> 
            "549" name="Tampa" /> 
            "491" name="Virgo" /> 
        
        "4-Door"> 
            "445" name="Admiral" /> 
            "438" name="Cabbie" /> 
            "507" name="Elegant" /> 
            "585" name="Emperor" /> 
            "466" name="Glendale" /> 
            "492" name="Greenwood" /> 
            "546" name="Intruder" /> 
            "551" name="Merit" /> 
            "516" name="Nebula" /> 
            "467" name="Oceanic" /> 
            "426" name="Premier" /> 
            "547" name="Primo" /> 
            "405" name="Sentinel" /> 
            "580" name="Stafford" /> 
            "409" name="Stretch" /> 
            "550" name="Sunrise" /> 
            "566" name="Tahoma" /> 
            "420" name="Taxi" /> 
            "540" name="Vincent" /> 
            "421" name="Washington" /> 
            "529" name="Willard" /> 
        
    
    "Emergency"> 
        "416" name="Ambulance" /> 
        "433" name="Barracks" /> 
        "427" name="Enforcer" /> 
        "490" name="FBI rancher" /> 
        "528" name="FBI truck" /> 
        "407" name="Fire truck" /> 
        "544" name="Fire truck (ladder)" /> 
        "596" name="Police car (LS)" /> 
        "598" name="Police car (LV)" /> 
        "597" name="Police car (SF)" /> 
        "599" name="Police ranger" /> 
        "432" name="Rhino" /> 
        "601" name="S.W.A.T." /> 
    
    "Heavy Vehicles"> 
        "Industrial"> 
            "524" name="Cement truck" /> 
            "578" name="DFT-30" /> 
            "486" name="Dozer" /> 
            "406" name="Dumper" /> 
            "573" name="Dune" /> 
            "455" name="Flatbed" /> 
            "530" name="Forklift" /> 
            "403" name="Linerunner" /> 
            "443" name="Packer" /> 
            "515" name="Roadtrain" /> 
            "574" name="Sweeper" /> 
            "514" name="Tanker" /> 
            "525" name="Towtruck" /> 
            "408" name="Trashmaster" /> 
            "552" name="Utility van" /> 
        
        "Trailers"> 
            "606" name="Baggage trailer (covered)" /> 
            "607" name="Baggage trailer (Uncovered)" /> 
            "610" name="Farm trailer" /> 
            "537" name="Freight train" /> 
            "590" name="Freight train boxcar" /> 
            "569" name="Freight train flatbed" /> 
            "611" name="Street Clean trailer" /> 
            "584" name="Gas trailer" /> 
            "608" name="Trailer 1" /> 
            "435" name="Trailer 2" /> 
            "450" name="Trailer 3" /> 
            "591" name="Trailer 4" /> 
        
        "Trucks"> 
            "499" name="Benson" /> 
            "609" name="Black Boxville" /> 
            "422" name="Bobcat" /> 
            "498" name="Boxville" /> 
            "414" name="Mule" /> 
            "600" name="Picador" /> 
            "543" name="Sadler" /> 
            "428" name="Securicar" /> 
            "478" name="Walton" /> 
            "456" name="Yankee" /> 
            "554" name="Yosemite" /> 
        
        "Vans"> 
            "459" name="Berkley's RC van" /> 
            "482" name="Burrito" /> 
            "483" name="Camper" /> 
            "508" name="Journey" /> 
            "418" name="Moonbeam" /> 
            "582" name="News van" /> 
            "413" name="Pony" /> 
            "440" name="Rumpo" /> 
        
    
    "Misc"> 
        "Other"> 
            "485" name="Baggage" /> 
            "568" name="Bandito" /> 
            "424" name="BF Injection" /> 
            "504" name="Bloodring Banger" /> 
            "538" name="Brownstreak Engine" /> 
            "431" name="Bus" /> 
            "457" name="Caddy" /> 
            "437" name="Coach" /> 
            "532" name="Combine harvester" /> 
            "588" name="Hotdog" /> 
            "434" name="Hotknife" /> 
            "494" name="Hotring racer" /> 
            "502" name="Hotring racer 2" /> 
            "503" name="Hotring racer 3" /> 
            "444" name="Monster" /> 
            "556" name="Monster 2" /> 
            "557" name="Monster 3" /> 
            "572" name="Mower" /> 
            "423" name="Mr. Whoopee" /> 
            "571" name="Kart" /> 
            "531" name="Tractor" /> 
            "449" name="Trolly" /> 
            "583" name="Tug" /> 
            "539" name="Vortex" /> 
        
        "RC Vehicles"> 
            "441" name="RC Bandit" /> 
            "464" name="RC Baron" /> 
            "594" name="RC Flower Pot" /> 
            "501" name="RC Goblin" /> 
            "465" name="RC Raider" /> 
            "564" name="RC Tiger" /> 
        
    
    "SUVs and Wagons"> 
        "589" name="Club" /> 
        "579" name="Huntley" /> 
        "400" name="Landstalker" /> 
        "500" name="Mesa" /> 
        "470" name="Patriot" /> 
        "404" name="Perennial" /> 
        "489" name="Rancher" /> 
        "479" name="Regina" /> 
        "442" name="Romero" /> 
        "495" name="Sandking" /> 
        "458" name="Solair" /> 
        "561" name="Stratum" /> 
    

Fr.Server.lua!

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('Welcome to Freeroam', player, 0, 255, 0)
        outputChatBox('Press F1 to show/hide controls', 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

Vehicles.xml!

type="vehicle"> 
    "Aircraft"> 
        "Helicopters"> 
            "548" name="Cargobob" /> 
            "425" name="Hunter" /> 
            "417" name="Leviathan" /> 
            "487" name="Maverick" /> 
            "488" name="News Chopper" /> 
            "497" name="Police Maverick" /> 
            "563" name="Raindance" /> 
            "447" name="Seasparrow" /> 
            "469" name="Sparrow" /> 
        
        "Planes, Jets and Airlines"> 
            "592" name="Andromada" /> 
            "577" name="AT-400" /> 
            "511" name="Beagle" /> 
            "512" name="Cropduster" /> 
            "593" name="Dodo" /> 
            "520" name="Hydra" /> 
            "553" name="Nevada" /> 
            "476" name="Rustler" /> 
            "519" name="Shamal" /> 
            "460" name="Skimmer" /> 
            "513" name="Stuntplane" /> 
        
    
    "Bikes"> 
        "Motorbikes"> 
            "581" name="BF-400" /> 
            "462" name="Faggio" /> 
            "521" name="FCR-900" /> 
            "463" name="Freeway" /> 
            "523" name="HPV1000" /> 
            "522" name="NRG-500" /> 
            "461" name="PCJ-600" /> 
            "448" name="Pizza Boy" /> 
            "468" name="Sanchez" /> 
            "586" name="Wayfarer" /> 
            "471" name="Quadbike" /> 
        
        "Bicycles"> 
            "509" name="Bike" /> 
            "481" name="BMX" /> 
            "510" name="Mountain bike" /> 
        
    
    "Boats"> 
        "472" name="Coastguard" /> 
        "473" name="Dinghy" /> 
        "493" name="Jetmax" /> 
        "595" name="Launch" /> 
        "484" name="Marquis" /> 
        "430" name="Predator" /> 
        "453" name="Reefer" /> 
        "452" name="Speeder" /> 
        "446" name="Squalo" /> 
        "454" name="Tropic" /> 
    
    "Cars"> 
        "Sports Cars"> 
            "602" name="Alpha" /> 
            "429" name="Banshee" /> 
            "402" name="Buffalo" /> 
            "541" name="Bullet" /> 
            "415" name="Cheetah" /> 
            "480" name="Comet" /> 
            "562" name="Elegy" /> 
            "587" name="Euros" /> 
            "565" name="Flash" /> 
            "411" name="Infernus" /> 
            "559" name="Jester" /> 
            "603" name="Phoenix" /> 
            "560" name="Sultan" /> 
            "506" name="Super GT" /> 
            "451" name="Turismo" /> 
            "558" name="Uranus" /> 
            "555" name="Windsor" /> 
            "477" name="ZR-350" /> 
        
        "Lowriders"> 
            "536" name="Blade" /> 
            "575" name="Broadway" /> 
            "518" name="Buccaneer" /> 
            "419" name="Esperanto" /> 
            "534" name="Remington" /> 
            "567" name="Savanna" /> 
            "535" name="Slamvan" /> 
            "576" name="Tornado" /> 
            "412" name="Voodoo" /> 
        
        "2-Door"> 
            "496" name="Blista Compact" /> 
            "401" name="Bravura" /> 
            "527" name="Cadrona" /> 
            "542" name="Clover" /> 
            "533" name="Feltzer" /> 
            "526" name="Fortune" /> 
            "474" name="Hermes" /> 
            "545" name="Hustler" /> 
            "517" name="Majestic" /> 
            "410" name="Manana" /> 
            "436" name="Previon" /> 
            "475" name="Sabre" /> 
            "439" name="Stallion" /> 
            "549" name="Tampa" /> 
            "491" name="Virgo" /> 
        
        "4-Door"> 
            "445" name="Admiral" /> 
            "438" name="Cabbie" /> 
            "507" name="Elegant" /> 
            "585" name="Emperor" /> 
            "466" name="Glendale" /> 
            "492" name="Greenwood" /> 
            "546" name="Intruder" /> 
            "551" name="Merit" /> 
            "516" name="Nebula" /> 
            "467" name="Oceanic" /> 
            "426" name="Premier" /> 
            "547" name="Primo" /> 
            "405" name="Sentinel" /> 
            "580" name="Stafford" /> 
            "409" name="Stretch" /> 
            "550" name="Sunrise" /> 
            "566" name="Tahoma" /> 
            "420" name="Taxi" /> 
            "540" name="Vincent" /> 
            "421" name="Washington" /> 
            "529" name="Willard" /> 
        
    
    "Emergency"> 
        "416" name="Ambulance" /> 
        "433" name="Barracks" /> 
        "427" name="Enforcer" /> 
        "490" name="FBI rancher" /> 
        "528" name="FBI truck" /> 
        "407" name="Fire truck" /> 
        "544" name="Fire truck (ladder)" /> 
        "596" name="Police car (LS)" /> 
        "598" name="Police car (LV)" /> 
        "597" name="Police car (SF)" /> 
        "599" name="Police ranger" /> 
        "432" name="Rhino" /> 
        "601" name="S.W.A.T." /> 
    
    "Heavy Vehicles"> 
        "Industrial"> 
            "524" name="Cement truck" /> 
            "578" name="DFT-30" /> 
            "486" name="Dozer" /> 
            "406" name="Dumper" /> 
            "573" name="Dune" /> 
            "455" name="Flatbed" /> 
            "530" name="Forklift" /> 
            "403" name="Linerunner" /> 
            "443" name="Packer" /> 
            "515" name="Roadtrain" /> 
            "574" name="Sweeper" /> 
            "514" name="Tanker" /> 
            "525" name="Towtruck" /> 
            "408" name="Trashmaster" /> 
            "552" name="Utility van" /> 
        
        "Trailers"> 
            "606" name="Baggage trailer (covered)" /> 
            "607" name="Baggage trailer (Uncovered)" /> 
            "610" name="Farm trailer" /> 
            "537" name="Freight train" /> 
            "590" name="Freight train boxcar" /> 
            "569" name="Freight train flatbed" /> 
            "611" name="Street Clean trailer" /> 
            "584" name="Gas trailer" /> 
            "608" name="Trailer 1" /> 
            "435" name="Trailer 2" /> 
            "450" name="Trailer 3" /> 
            "591" name="Trailer 4" /> 
        
        "Trucks"> 
            "499" name="Benson" /> 
            "609" name="Black Boxville" /> 
            "422" name="Bobcat" /> 
            "498" name="Boxville" /> 
            "414" name="Mule" /> 
            "600" name="Picador" /> 
            "543" name="Sadler" /> 
            "428" name="Securicar" /> 
            "478" name="Walton" /> 
            "456" name="Yankee" /> 
            "554" name="Yosemite" /> 
        
        "Vans"> 
            "459" name="Berkley's RC van" /> 
            "482" name="Burrito" /> 
            "483" name="Camper" /> 
            "508" name="Journey" /> 
            "418" name="Moonbeam" /> 
            "582" name="News van" /> 
            "413" name="Pony" /> 
            "440" name="Rumpo" /> 
        
    
    "Misc"> 
        "Other"> 
            "485" name="Baggage" /> 
            "568" name="Bandito" /> 
            "424" name="BF Injection" /> 
            "504" name="Bloodring Banger" /> 
            "538" name="Brownstreak Engine" /> 
            "431" name="Bus" /> 
            "457" name="Caddy" /> 
            "437" name="Coach" /> 
            "532" name="Combine harvester" /> 
            "588" name="Hotdog" /> 
            "434" name="Hotknife" /> 
            "494" name="Hotring racer" /> 
            "502" name="Hotring racer 2" /> 
            "503" name="Hotring racer 3" /> 
            "444" name="Monster" /> 
            "556" name="Monster 2" /> 
            "557" name="Monster 3" /> 
            "572" name="Mower" /> 
            "423" name="Mr. Whoopee" /> 
            "571" name="Kart" /> 
            "531" name="Tractor" /> 
            "449" name="Trolly" /> 
            "583" name="Tug" /> 
            "539" name="Vortex" /> 
        
        "RC Vehicles"> 
            "441" name="RC Bandit" /> 
            "464" name="RC Baron" /> 
            "594" name="RC Flower Pot" /> 
            "501" name="RC Goblin" /> 
            "465" name="RC Raider" /> 
            "564" name="RC Tiger" /> 
        
    
    "SUVs and Wagons"> 
        "589" name="Club" /> 
        "579" name="Huntley" /> 
        "400" name="Landstalker" /> 
        "500" name="Mesa" /> 
        "470" name="Patriot" /> 
        "404" name="Perennial" /> 
        "489" name="Rancher" /> 
        "479" name="Regina" /> 
        "442" name="Romero" /> 
        "495" name="Sandking" /> 
        "458" name="Solair" /> 
        "561" name="Stratum" /> 
    

Fr.Server.lua!

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('Welcome to Freeroam', player, 0, 255, 0)
        outputChatBox('Press F1 to show/hide controls', 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

Replace the files with this :

vehicles.xml :

type="vehicle">    name="Aircraft">        name="Helicopters">            id="548" name="Cargobob" />            id="417" name="Leviathan" />            id="487" name="Maverick" />            id="488" name="News Chopper" />            id="497" name="Police Maverick" />            id="563" name="Raindance" />            id="447" name="Seasparrow" />            id="469" name="Sparrow" />        >        name="Planes, Jets and Airlines">            id="592" name="Andromada" />            id="577" name="AT-400" />            id="511" name="Beagle" />            id="512" name="Cropduster" />            id="593" name="Dodo" />            id="553" name="Nevada" />            id="476" name="Rustler" />            id="519" name="Shamal" />            id="460" name="Skimmer" />            id="513" name="Stuntplane" />        >    >    name="Bikes">        name="Motorbikes">            id="581" name="BF-400" />            id="462" name=":O" />            id="521" name="FCR-900" />            id="463" name="Freeway" />            id="523" name="HPV1000" />            id="522" name="NRG-500" />            id="461" name="PCJ-600" />            id="448" name="Pizza Boy" />            id="468" name="Sanchez" />            id="586" name="Wayfarer" />            id="471" name="Quadbike" />        >        name="Bicycles">            id="509" name="Bike" />            id="481" name="BMX" />            id="510" name="Mountain bike" />        >    >    name="Boats">        id="472" name="Coastguard" />        id="473" name="Dinghy" />        id="493" name="Jetmax" />        id="595" name="Launch" />        id="484" name="Marquis" />        id="430" name="Predator" />        id="453" name="Reefer" />        id="452" name="Speeder" />        id="446" name="Squalo" />        id="454" name="Tropic" />    >    name="Cars">        name="Sports Cars">            id="602" name="Alpha" />            id="429" name="Banshee" />            id="402" name="Buffalo" />            id="541" name="Bullet" />            id="415" name="Cheetah" />            id="480" name="Comet" />            id="562" name="Elegy" />            id="587" name="Euros" />            id="565" name="Flash" />            id="411" name="Infernus" />            id="559" name="Jester" />            id="603" name="Phoenix" />            id="560" name="Sultan" />            id="506" name="Super GT" />            id="451" name="Turismo" />            id="558" name="Uranus" />            id="555" name="Windsor" />            id="477" name="ZR-350" />        >        name="Lowriders">            id="536" name="Blade" />            id="575" name="Broadway" />            id="518" name="Buccaneer" />            id="419" name="Esperanto" />            id="534" name="Remington" />            id="567" name="Savanna" />            id="535" name="Slamvan" />            id="576" name="Tornado" />            id="412" name="Voodoo" />        >        name="2-Door">            id="496" name="Blista Compact" />            id="401" name="Bravura" />            id="527" name="Cadrona" />            id="542" name="Clover" />            id="533" name="Feltzer" />            id="526" name="Fortune" />            id="474" name="Hermes" />            id="545" name="Hustler" />            id="517" name="Majestic" />            id="410" name="Manana" />            id="436" name="Previon" />            id="475" name="Sabre" />            id="439" name="Stallion" />            id="549" name="Tampa" />            id="491" name="Virgo" />        >        name="4-Door">            id="445" name="Admiral" />            id="438" name="Cabbie" />            id="507" name="Elegant" />            id="585" name="Emperor" />            id="466" name="Glendale" />            id="492" name="Greenwood" />            id="546" name="Intruder" />            id="551" name="Merit" />            id="516" name="Nebula" />            id="467" name="Oceanic" />            id="426" name="Premier" />            id="547" name="Primo" />            id="405" name="Sentinel" />            id="580" name="Stafford" />            id="409" name="Stretch" />            id="550" name="Sunrise" />            id="566" name="Tahoma" />            id="420" name="Taxi" />            id="540" name="Vincent" />            id="421" name="Washington" />            id="529" name="Willard" />        >    >    name="Emergency">        id="416" name="Ambulance" />        id="433" name="Barracks" />        id="427" name="Enforcer" />        id="490" name="FBI rancher" />        id="528" name="FBI truck" />        id="407" name="Fire truck" />        id="544" name="Fire truck (ladder)" />        id="596" name="Police car (LS)" />        id="598" name="Police car (LV)" />        id="597" name="Police car (SF)" />        id="599" name="Police ranger" />        id="601" name="S.W.A.T." />    >    name="Heavy Vehicles">        name="Industrial">            id="524" name="Cement truck" />            id="578" name="DFT-30" />            id="486" name="Dozer" />            id="406" name="Dumper" />            id="573" name="Dune" />            id="455" name="Flatbed" />            id="530" name="Forklift" />            id="403" name="Linerunner" />            id="443" name="Packer" />            id="515" name="Roadtrain" />            id="574" name="Sweeper" />            id="514" name="Tanker" />            id="525" name="Towtruck" />            id="408" name="Trashmaster" />            id="552" name="Utility van" />        >        name="Trailers">            id="606" name="Baggage trailer (covered)" />            id="607" name="Baggage trailer (Uncovered)" />            id="610" name="Farm trailer" />            id="537" name="Freight train" />            id="590" name="Freight train boxcar" />            id="569" name="Freight train flatbed" />            id="611" name="Street Clean trailer" />            id="584" name="Gas trailer" />            id="608" name="Trailer 1" />            id="435" name="Trailer 2" />            id="450" name="Trailer 3" />            id="591" name="Trailer 4" />        >        name="Trucks">            id="499" name="Benson" />            id="609" name="Black Boxville" />            id="422" name="Bobcat" />            id="498" name="Boxville" />            id="414" name="Mule" />            id="600" name="Picador" />            id="543" name="Sadler" />            id="428" name="Securicar" />            id="478" name="Walton" />            id="456" name="Yankee" />            id="554" name="Yosemite" />        >        name="Vans">            id="459" name="Berkley's RC van" />            id="482" name="Burrito" />            id="483" name="Camper" />            id="508" name="Journey" />            id="418" name="Moonbeam" />            id="582" name="News van" />            id="413" name="Pony" />            id="440" name="Rumpo" />        >    >    name="Misc">        name="Other">            id="485" name="Baggage" />            id="568" name="Bandito" />            id="424" name="BF Injection" />            id="504" name="Bloodring Banger" />            id="538" name="Brownstreak Engine" />            id="431" name="Bus" />            id="457" name="Caddy" />            id="437" name="Coach" />            id="532" name="Combine harvester" />            id="588" name="Hotdog" />            id="434" name="Hotknife" />            id="494" name="Hotring racer" />            id="502" name="Hotring racer 2" />            id="503" name="Hotring racer 3" />            id="444" name="Monster" />            id="556" name="Monster 2" />            id="557" name="Monster 3" />            id="572" name="Mower" />            id="423" name="Mr. Whoopee" />            id="571" name="Kart" />            id="531" name="Tractor" />            id="449" name="Trolly" />            id="583" name="Tug" />            id="539" name="Vortex" />        >        name="RC Vehicles">            id="441" name="RC Bandit" />            id="464" name="RC Baron" />            id="594" name="RC Flower Pot" />            id="501" name="RC Goblin" />            id="465" name="RC Raider" />            id="564" name="RC Tiger" />        >    >    name="SUVs and Wagons">        id="589" name="Club" />        id="579" name="Huntley" />        id="400" name="Landstalker" />        id="500" name="Mesa" />        id="470" name="Patriot" />        id="404" name="Perennial" />        id="489" name="Rancher" />        id="479" name="Regina" />        id="442" name="Romero" />        id="495" name="Sandking" />        id="458" name="Solair" />        id="561" name="Stratum" />    >>

fr_client.lua :

CONTROL_MARGIN_RIGHT = 5 
LINE_MARGIN = 5
LINE_HEIGHT = 16
 
g_Root = getRootElement()
g_ResRoot = getResourceRootElement(getThisResource())
g_Me = getLocalPlayer()
server = createServerCallInterface()
guiSetInputMode("no_binds_when_editing")
 
---------------------------
-- Set skin window
---------------------------
function skinInit()
    setControlNumber(wndSkin, 'skinid', getElementModel(g_Me))
end
 
function showSkinID(leaf)
    if leaf.id then
        setControlNumber(wndSkin, 'skinid', leaf.id)
    end
end
 
function applySkin()
    local skinID = getControlNumber(wndSkin, 'skinid')
    if skinID then
        server.setMySkin(skinID)
        fadeCamera(true)
    end
end
 
wndSkin = {
    'wnd',
    text = 'Set skin',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='skinlist',
            width=230,
            height=290,
            columns={
                {text='Skin', attr='name'}
            },
            rows={xml='skins.xml', attrs={'id', 'name'}},
            onitemclick=showSkinID,
            onitemdoubleclick=applySkin
        },
        {'txt', id='skinid', text='', width=50},
        {'btn', id='set', onclick=applySkin},
        {'btn', id='close', closeswindow=true}
    },
    oncreate = skinInit
}
 
function setSkinCommand(cmd, skin)
    skin = skin and tonumber(skin)
    if skin then
        server.setMySkin(skin)
        fadeCamera(true)
        closeWindow(wndSpawnMap)
        closeWindow(wndSetPos)
    end
end
addCommandHandler('setskin', setSkinCommand)
addCommandHandler('ss', setSkinCommand)
 
---------------------------
--- Set animation window
---------------------------
 
function applyAnimation(leaf)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndAnim, 'animlist')
        if not leaf then
            return
        end
    end
    server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true)
end
 
function stopAnimation()
    server.setPedAnimation(g_Me, false)
end
addCommandHandler("stopanim", stopAnimation)
bindKey("lshift", "down", "stopanim")
 
wndAnim = {
    'wnd',
    text = 'Set animation',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='animlist',
            width=230,
            height=290,
            columns={
                {text='Animation', attr='name'}
            },
            rows={xml='animations.xml', attrs={'name'}},
            expandlastlevel=false,
            onitemdoubleclick=applyAnimation
        },
        {'btn', id='set', onclick=applyAnimation},
        {'btn', id='stop', onclick=stopAnimation},
        {'btn', id='close', closeswindow=true}
    }
}
 
addCommandHandler('anim',
    function(command, lib, name)
        server.setPedAnimation(g_Me, lib, name, true, true)
    end
)
 
---------------------------
-- Weapon window
---------------------------
 
function addWeapon(leaf, amount)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist')
        amount = getControlNumber(wndWeapon, 'amount')
        if not amount or not leaf then
            return
        end
    end
    server.giveMeWeapon(leaf.id, amount)
end
 
wndWeapon = {
    'wnd',
    text = 'Give weapon',
    width = 250,
    controls = {
        {
            'lst',
            id='weaplist',
            width=230,
            height=280,
            columns={
                {text='Weapon', attr='name'}
            },
            rows={xml='weapons.xml', attrs={'id', 'name'}},
            onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end
        },
        {'br'},
        {'txt', id='amount', text='500', width=60},
        {'btn', id='add', onclick=addWeapon},
        {'btn', id='close', closeswindow=true}
    }
}
 
function giveWeaponCommand(cmd, weapon, amount)
    weapon = tonumber(weapon) or getWeaponIDFromName(weapon)
    if not weapon then
        return
    end
    amount = amount and tonumber(amount) or 500
    server.giveMeWeapon(math.floor(weapon), amount)
end
addCommandHandler('give', giveWeaponCommand)
addCommandHandler('wp', giveWeaponCommand)
 
---------------------------
-- Fighting style
---------------------------
 
addCommandHandler('setstyle',
    function(cmd, style)
        style = style and tonumber(style)
        if style then
            server.setPedFightingStyle(g_Me, style)
        end
    end
)
 
---------------------------
-- Clothes window
---------------------------
function clothesInit()
    if getElementModel(g_Me) ~= 0 then
        errMsg('You must have the CJ skin set in order to apply clothes.')
        closeWindow(wndClothes)
        return
    end
    if not g_Clothes then
        triggerServerEvent('onClothesInit', g_Me)
    end
end
 
addEvent('onClientClothesInit', true)
addEventHandler('onClientClothesInit', g_Root,
    function(clothes)
        g_Clothes = clothes.allClothes
        for i,typeGroup in ipairs(g_Clothes) do
            for j,cloth in ipairs(typeGroup.children) do
                if not cloth.name then
                    cloth.name = cloth.model .. ' - ' .. cloth.texture
                end
                cloth.wearing =
                    clothes.playerClothes[typeGroup.type] and
                    clothes.playerClothes[typeGroup.type].texture == cloth.texture and
                    clothes.playerClothes[typeGroup.type].model == cloth.model
                    or false
            end
            table.sort(typeGroup.children, function(a, b) return a.name < b.name end)
        end
        bindGridListToTable(wndClothes, 'clothes', g_Clothes, false)
    end
)
 
function clothListClick(cloth)
    setControlText(wndClothes, 'addremove', cloth.wearing and 'remove' or 'add')
end
 
function applyClothes(cloth)
    if not cloth then
        cloth = getSelectedGridListLeaf(wndClothes, 'clothes')
        if not cloth then
            return
        end
    end
    if cloth.wearing then
        cloth.wearing = false
        setControlText(wndClothes, 'addremove', 'add')
        server.removePlayerClothes(g_Me, cloth.parent.type)
    else
        local prevClothIndex = table.find(cloth.siblings, 'wearing', true)
        if prevClothIndex then
            cloth.siblings[prevClothIndex].wearing = false
        end
        cloth.wearing = true
        setControlText(wndClothes, 'addremove', 'remove')
        server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type)
    end
end
 
wndClothes = {
    'wnd',
    text = 'Clothes',
    x = -20,
    y = 0.3,
    width = 350,
    controls = {
        {
           
Link to comment

OK Use the vehicles xml file i gave you and replace the fr_client.lua with this :

CONTROL_MARGIN_RIGHT = 5 
LINE_MARGIN = 5
LINE_HEIGHT = 16
 
g_Root = getRootElement()
g_ResRoot = getResourceRootElement(getThisResource())
g_Me = getLocalPlayer()
server = createServerCallInterface()
guiSetInputMode("no_binds_when_editing")
 
---------------------------
-- Set skin window
---------------------------
function skinInit()
    setControlNumber(wndSkin, 'skinid', getElementModel(g_Me))
end
 
function showSkinID(leaf)
    if leaf.id then
        setControlNumber(wndSkin, 'skinid', leaf.id)
    end
end
 
function applySkin()
    local skinID = getControlNumber(wndSkin, 'skinid')
    if skinID then
        server.setMySkin(skinID)
        fadeCamera(true)
    end
end
 
wndSkin = {
    'wnd',
    text = 'Set skin',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='skinlist',
            width=230,
            height=290,
            columns={
                {text='Skin', attr='name'}
            },
            rows={xml='skins.xml', attrs={'id', 'name'}},
            onitemclick=showSkinID,
            onitemdoubleclick=applySkin
        },
        {'txt', id='skinid', text='', width=50},
        {'btn', id='set', onclick=applySkin},
        {'btn', id='close', closeswindow=true}
    },
    oncreate = skinInit
}
 
function setSkinCommand(cmd, skin)
    skin = skin and tonumber(skin)
    if skin then
        server.setMySkin(skin)
        fadeCamera(true)
        closeWindow(wndSpawnMap)
        closeWindow(wndSetPos)
    end
end
addCommandHandler('setskin', setSkinCommand)
addCommandHandler('ss', setSkinCommand)
 
---------------------------
--- Set animation window
---------------------------
 
function applyAnimation(leaf)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndAnim, 'animlist')
        if not leaf then
            return
        end
    end
    server.setPedAnimation(g_Me, leaf.parent.name, leaf.name, true, true)
end
 
function stopAnimation()
    server.setPedAnimation(g_Me, false)
end
addCommandHandler("stopanim", stopAnimation)
bindKey("lshift", "down", "stopanim")
 
wndAnim = {
    'wnd',
    text = 'Set animation',
    width = 250,
    x = -20,
    y = 0.3,
    controls = {
        {
            'lst',
            id='animlist',
            width=230,
            height=290,
            columns={
                {text='Animation', attr='name'}
            },
            rows={xml='animations.xml', attrs={'name'}},
            expandlastlevel=false,
            onitemdoubleclick=applyAnimation
        },
        {'btn', id='set', onclick=applyAnimation},
        {'btn', id='stop', onclick=stopAnimation},
        {'btn', id='close', closeswindow=true}
    }
}
 
addCommandHandler('anim',
    function(command, lib, name)
        server.setPedAnimation(g_Me, lib, name, true, true)
    end
)
 
---------------------------
-- Weapon window
---------------------------
 
function addWeapon(leaf, amount)
    if type(leaf) ~= 'table' then
        leaf = getSelectedGridListLeaf(wndWeapon, 'weaplist')
        amount = getControlNumber(wndWeapon, 'amount')
        if not amount or not leaf then
            return
        end
    end
    server.giveMeWeapon(leaf.id, amount)
end
 
wndWeapon = {
    'wnd',
    text = 'Give weapon',
    width = 250,
    controls = {
        {
            'lst',
            id='weaplist',
            width=230,
            height=280,
            columns={
                {text='Weapon', attr='name'}
            },
            rows={xml='weapons.xml', attrs={'id', 'name'}},
            onitemdoubleclick=function(leaf) addWeapon(leaf, 500) end
        },
        {'br'},
        {'txt', id='amount', text='500', width=60},
        {'btn', id='add', onclick=addWeapon},
        {'btn', id='close', closeswindow=true}
    }
}
 
function giveWeaponCommand(cmd, weapon, amount)
    weapon = tonumber(weapon) or getWeaponIDFromName(weapon)
    if not weapon then
        return
    end
    amount = amount and tonumber(amount) or 500
    server.giveMeWeapon(math.floor(weapon), amount)
end
addCommandHandler('give', giveWeaponCommand)
addCommandHandler('wp', giveWeaponCommand)
 
---------------------------
-- Fighting style
---------------------------
 
addCommandHandler('setstyle',
    function(cmd, style)
        style = style and tonumber(style)
        if style then
            server.setPedFightingStyle(g_Me, style)
        end
    end
)
 
---------------------------
-- Clothes window
---------------------------
function clothesInit()
    if getElementModel(g_Me) ~= 0 then
        errMsg('You must have the CJ skin set in order to apply clothes.')
        closeWindow(wndClothes)
        return
    end
    if not g_Clothes then
        triggerServerEvent('onClothesInit', g_Me)
    end
end
 
addEvent('onClientClothesInit', true)
addEventHandler('onClientClothesInit', g_Root,
    function(clothes)
        g_Clothes = clothes.allClothes
        for i,typeGroup in ipairs(g_Clothes) do
            for j,cloth in ipairs(typeGroup.children) do
                if not cloth.name then
                    cloth.name = cloth.model .. ' - ' .. cloth.texture
                end
                cloth.wearing =
                    clothes.playerClothes[typeGroup.type] and
                    clothes.playerClothes[typeGroup.type].texture == cloth.texture and
                    clothes.playerClothes[typeGroup.type].model == cloth.model
                    or false
            end
            table.sort(typeGroup.children, function(a, b) return a.name < b.name end)
        end
        bindGridListToTable(wndClothes, 'clothes', g_Clothes, false)
    end
)
 
function clothListClick(cloth)
    setControlText(wndClothes, 'addremove', cloth.wearing and 'remove' or 'add')
end
 
function applyClothes(cloth)
    if not cloth then
        cloth = getSelectedGridListLeaf(wndClothes, 'clothes')
        if not cloth then
            return
        end
    end
    if cloth.wearing then
        cloth.wearing = false
        setControlText(wndClothes, 'addremove', 'add')
        server.removePlayerClothes(g_Me, cloth.parent.type)
    else
        local prevClothIndex = table.find(cloth.siblings, 'wearing', true)
        if prevClothIndex then
            cloth.siblings[prevClothIndex].wearing = false
        end
        cloth.wearing = true
        setControlText(wndClothes, 'addremove', 'remove')
        server.addPedClothes(g_Me, cloth.texture, cloth.model, cloth.parent.type)
    end
end
 
wndClothes = {
    'wnd',
    text = 'Clothes',
    x = -20,
    y = 0.3,
    width = 350,
    controls = {
        {
           
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...