Jump to content

Help with a few scripts i obtain


Toffbrown

Recommended Posts

i have this freeroam panel f1 script i made (with some lovely help from KenXeiko with spawning in car) but i have a problem that the cars randomly dissapear when you are driving a car

this is car spawner from the fr_server.lua

-- Edited from here! 
    local px, py, pz, protx, proty, protz -- Define the data 
    local radius = 3 
    local playerVehicle = getPedOccupiedVehicle(source) 
    if playerVehicle and isElement(playerVehicle) then -- If there player was in a vehicle 
        px, py, pz = getElementPosition(playerVehicle) -- Get the position of the vehicle 
        protx, proty, protz = getVehicleRotation(playerVehicle) -- Get the rotation of the vehicle 
    else -- If the player was on foot 
        px, py, pz = getElementPosition(source) -- Get the position of the player 
        protz = getPedRotation(source) -- Get the Z rotation of the player 
        protx, proty = 0, 0 -- Define the X and Y rotation as 0, since 'getPedRotation' function would only return the Z rotation 
    end 
    --[[ Things below are not neccessary because the new function would use enhanced data 
    local offsetRot = math.rad(prot) 
    local vx = px + radius * math.cos(offsetRot) 
    local vy = py + radius * math.sin(offsetRot) 
    local vz = pz + 2 
    local vrot = prot]] 
    local vehicleList = g_PlayerData[source].vehicles 
    local vehicle 
    if ( not vehicles ) then return end 
    for i,vehID in ipairs(vehicles) do 
        if vehID < 400 or vehID > 611 then 
            errMsg(vehID ..' is incorrect vehicle model', source) 
        elseif not table.find(getOption('432'), vehID) then  
            if playerVehicle and isElement(playerVehicle) then -- If the player was in a vehicle 
                setElementModel (playerVehicle, vehID) -- Change the model of the current vehicle 
                vehicle = playerVehicle -- set 'vehicle' data into 'playerVehicle' for further function 
            else -- If the player was on foot 
                vehicle = createVehicle(vehID, px, py, pz, protx, proty, protz) -- Create a vehicle with the desired ID, and follow the position and rotation of the player 
                if (not isElement(vehicle)) then return end -- If it couldn't create the vehicle, skip the whole function 
                warpPedIntoVehicle (source, vehicle) -- Warp the player to the vehicle right away 
                if #vehicleList >= getOption('vehicles.maxperplayer') then -- If the player passed the vehicle limit 
                    unloadVehicle(vehicleList[3]) -- Remove the first vehicle on the list (in this case the old one, based on your desired limit by the way, call me on Skype for further information about this) 
                end 
                table.insert(vehicleList, vehicle) -- Add the vehicle to 'vehicleList' table, so it would be possible for the function to check old car to remove with the function above 
                g_VehicleData[vehicle] = { creator = source, timers = {} } -- Add neccessary data to the table 
            end 
            setElementInterior(vehicle, getElementInterior(source)) -- Set the Interior of the vehicle into the same Interior as the player 
            setElementDimension(vehicle, getElementDimension(source)) -- Set the Dimension of the vehicle into the same Dimension as the player 
            if not g_Trailers[vehID] then -- If the desired Vehicle ID isn't trailer 
                if getOption('vehicles.idleexplode') then -- If you want the system to blow/remove the vehicle (freeroam setting) 
                    g_VehicleData[vehicle].timers.fire = setTimer(commitArsonOnVehicle, getOption('vehicles.maxidletime'), 1, vehicle) -- Add neccessary data to the table about the time limit 
                end 
            end 
            -- Until here! 

i also want to make to my f1 panel i made/tweaked for my servers theme is instead of saying guthix player it would say their name (i have tried getlocal player functions etc but the whole panel doesnt work) if someone could help me

wndMain = { 
    'wnd', 
    text = 'Guthix Freeroam 1.3', 
    x = 10, 
    y = 180, 
    width = 280, 
    controls = { 
        {'lbl', text='Guthix Freeroam'},-----------------------------I want to make it say the players name so like their Nickname/tag example if my name was John it would say John 
        {'img', src='test.png', width=325, height=100}, 
        {'br'}, 
        {'img', src='test2.png', width=260, height=5 }, 
        {'btn', id='weapon', window=wndWeapon}, 
        {'btn', id='Skins', window=wndSkin}, 
        {'btn', id='Body Type', window=wndStats},        
        {'br'}, 
        {'btn', id='Jetpack', onclick=toggleJetPack}, 
        {'btn', id='Animations', window=wndAnim}, 
        {'btn', id='CJ Clothes', window=wndClothes}, 
        {'img', src='test2.png', width=280, height=5 }, 
        {'btn', id='setpos', text='World Map', window=wndSetPos}, 
        {'btn', id='Time Settings', onclick=openTimeSettings},       
        {'img', src='test2.png', width=280, height=5 }, 
        {'chk', id='bikefalloff', text='Stay On Bike', onclick=toggleBikeFallOff}, 
        {'img', src='test2.png', width=280, height=5 }, 
        {'btn', id='Graphics', window=wndPaintjob}, 
        {'btn', id='Paint', onclick=openColorPicker}, 
        {'btn', id='Customize', window=wndUpgrades}, 
        {'br'}, 
        {'btn', id='Repair', onclick=repairVehicle}, 
        {'btn', id='Flip', onclick=flipVehicle}, 
        {'img', src='test2.png', width=280, height=5 }, 
        {'lbl', text='Vehicle Name:'}, 
        {'lbl', id='curvehicle'}, 
        {'br'}, 
        {'btn', id='createvehicle', window=wndCreateVehicle, text='Vehicle List'}, 
        {'lbl', text='How to spawn vehicles:type /cv vehiclename'}, 
        {'lbl', text='And then you will automaticly'}, 
        {'lbl', text='spawn inside of the vehicle.'}, 
        {'img', src='test2.png', width=280, height=3 }, 
        {'br'}, 
        {'chk', id='lightson', text='Lights on', onclick=forceLightsOn}, 
        {'chk', id='lightsoff', text='Lights off', onclick=forceLightsOff}, 
        {'lbl', text='Created by: Toff'}, 
    }, 

and someon elses script i downloaded of the resources made by: Yakuza.Real and solidsnake and kenix stated by the resource but tweaked (https://community.multitheftauto.com/ind ... ls&id=4784) how can i make it say my own custom time for certain people because i know the hours they have played for?

thanks for reading and if you can help

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