Jump to content

how to create a multi worlds


RenanPG

Recommended Posts

HI folks, i am trying to create a freeroam gui, with multi worlds, for exemple: zombies, deathmatch, freeroam or whatever. And i need help from anyone to help me.

i Created a gui with worlds, but i want that when the player select a world, he will teleported for other world, with different map. but using the main chat of the server.

Link to comment

I SETTED THIS ON MY FREEROAM CLIENT:

--------------------------- 
-- Worlds 
--------------------------- 
  
function setInterior(leaf) 
    server.setElementInterior(g_Me, leaf.world) 
    local vehicle = getPedOccupiedVehicle(g_Me) 
    if vehicle then 
        server.setElementInterior(vehicle, leaf.world) 
        for i=0,getVehicleMaxPassengers(vehicle) do 
            local player = getVehicleOccupant(vehicle, i) 
            if player and player ~= g_Me then 
                server.setElementInterior(player, leaf.world) 
                server.setCameraInterior(player, leaf.world) 
                                server.setFarClipDistance(player, leaf.farclip) 
                                server.setWeapons(player, leaf.weapons) 
  
                                server.setElementDimension(player, leaf.dimension) 
            end 
        end 
    end 
    setCameraInterior(leaf.world) 
    setPlayerPosition(leaf.posX, leaf.posY, leaf.posZ + 1) 
        setFarClipDistance(leaf.farclip) 
        setWeapons(leaf.weapons) 
        setElementDimension(leaf.dimension) 
    closeWindow(wndSetWorld) 
end 
  
wndSetWorld = { 
    'wnd', 
    text = 'Set World', 
    width = 250, 
    controls = { 
        { 
            'lst', 
            id='world', 
            width=230, 
            height=300, 
            columns={ 
                {text='World', attr='world' , attr='name'} 
            }, 
            rows={xml='worlds.xml', attrs={'name', 'posX', 'posY', 'posZ', 'farclip', 'weapons' , 'dimension'}}, 
            onitemdoubleclick=setInterior 
        }, 
        {'btn', id='Fechar', closeswindow=true} 
    } 
} 
  
  
  

AND I PUTTED IT ON WORLDS LIST:

type="world"> 
        "World 0 - Freeroam" posX="0" posY="0" posZ="0" farclip="5000" weapons="0" dimension="0"/> 
        "World 1 - Deathmatch" posX="0" posY="0" posZ="0" farclip="500" dimension="1"/> 
        "World 2 - Zombies" posX="0" posY="0" posZ="0" farclip="500" dimension="2"/> 

  

IS THIS CORRECT???

Edited by Guest
Link to comment

Why are you using farclip ? It's not a RPC function !

If you want to! you have to edit the server side. Because you are using a server interface call. BTW try this:

function setWorld( leaf ) 
    server.setElementDimension( g_Me, leaf.dimension ) 
    local vehicle = getPedOccupiedVehicle( g_Me ) 
    if vehicle then 
        server.setElementDimension( vehicle, leaf.dimension ) 
        --This will set the dimension for everyone in the vehicle. 
        --[[for i=0,getVehicleMaxPassengers( vehicle ) do 
            local player = getVehicleOccupant( vehicle, i ) 
            if player and player ~= g_Me then 
                server.setElementDimension( player, leaf.dimension ) 
            end 
        end]] 
    end 
    setPlayerPosition( leaf.posX, leaf.posY, leaf.posZ + 1 ) 
    setFarClipDistance( leaf.farclip ) 
    closeWindow( wndSetWorld ) 
end 
  
wndSetWorld = { 
    'wnd', 
    text = 'Set World', 
    width = 250, 
    controls = { 
        { 
            'lst', 
            id = 'world', 
            width = 230, 
            height = 300, 
            columns = {  
                { text = 'Multi Worlds', attr = 'name' }  
            }, rows = { xml = 'worlds.xml', attrs = { 'name', 'posX', 'posY', 'posZ', 'farclip', 'dimension' } }, 
            onitemdoubleclick = setWorld 
        }, 
        {'btn', id='close', closeswindow=true} 
    } 
} 

type="world"> 
    "Freeroam" posX="0" posY="0" posZ="0" farclip="0" dimension="0"/> 
    "Deathmatch" posX="0" posY="0" posZ="0" farclip="0" dimension="1"/> 
    "Zombies" posX="0" posY="0" posZ="0" farclip="0" dimension="2"/> 

And don't forget to replace the server side with this:

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, 
    setCameraInterior = true, 
    warpMe = { option = 'warp', descr = 'Warping' }, 
    -- I edit here 
    setElementDimension = true, 
    -- 
} 

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