Jump to content

Starting a gamemode on another dimension


GamingTim

Recommended Posts

Okay so, i'm not too sure on how to start a gamemode on another diemension, like for example, in the main world there's a lobby, also there's a race gamemode on another dimension and stunts in another dimension.

I'm currently looking on this function setElementDimension, what other fucntions, events shall i use?.

Link to comment

I wouldn't call it complex at all. You can even make a system like that in five minutes or less depending on your needs. Simply put, you create a system that divides gamemodes into dimensions.

If you want to use the default gamemodes in it, that's not a problem, you just have to check the player's gamemode and only trigger events and functions for those that are in that specific gamemode. There's nothing more to that really.

@Bonsai: Well, since you're the expert - how did FFS got it to work with the default race script? Because they did, and there was no need to make their own.

Edited by Guest
Link to comment

10minutes..

client:

exports.scoreboard:scoreboardAddColumn("World")  
addEventHandler("onClientPlayerJoin", getRootElement(), 
function() 
setElementData(localPlayer, "World", "Lobby") 
end) 
--#Draw World Gui 
function drawWorldGUI() 
        lobby = guiCreateWindow(0.26, 0.39, 0.48, 0.21, "World GUI", true) 
        guiWindowSetMovable(lobby, false) 
        guiWindowSetSizable(lobby, false) 
        guiSetVisible(lobby,false)   
  
        FreeroamBtn = guiCreateButton(0.04, 0.59, 0.30, 0.35, "Freeroam", true, lobby) 
         
        StuntBtn = guiCreateButton(0.35, 0.59, 0.30, 0.35, "Stunt", true, lobby) 
         
        FunBtn = guiCreateButton(0.67, 0.59, 0.30, 0.35, "FUN", true, lobby) 
         
        lobbyBtn = guiCreateButton(0.66, 0.36, 0.08, 0.03, "Lobby", true) 
        guiSetVisible(lobbyBtn,false) 
         
        Info = guiCreateLabel(0.05, 0.13, 0.90, 0.42, "Welcome\nSelect world to play", true, lobby) 
        guiSetFont(Info, "default-bold-small") 
        guiLabelSetHorizontalAlign(Info, "center", false) 
        guiLabelSetVerticalAlign(Info, "center")     
    end 
addEventHandler("onClientResourceStart", resourceRoot, drawWorldGUI) 
--#Bind GUI 
bindKey("F1", "down", 
function() 
    if guiGetVisible(lobby) == true then 
    guiSetVisible(lobby,false) 
    guiSetVisible(lobbyBtn,false) 
    showCursor(false) 
    else     
    guiSetVisible(lobby,true) 
    guiSetVisible(lobbyBtn,true) 
    showCursor(true) 
    end 
end) 
addEventHandler("onClientGUIClick", root, 
function() 
if source == FreeroamBtn then 
outputChatBox("Succesfully joined Freeroam World", 0, 200, 0, true) 
setElementData(localPlayer, "World", "Freeroam") 
    triggerServerEvent("onPlayerFreeroamEnter", getLocalPlayer()) 
elseif source == StuntBtn then 
outputChatBox("Succesfully joined Stunt World", 0, 200, 0, true) 
setElementData(localPlayer, "World", "Stunt") 
    triggerServerEvent("onPlayerStuntEnter", getLocalPlayer()) 
elseif source == FunBtn then 
outputChatBox("Succesfully joined Fun World", 0, 200, 0, true) 
setElementData(localPlayer, "World", "Fun") 
    triggerServerEvent("onPlayerFunEnter", getLocalPlayer()) 
elseif source == LobbyBtn then 
outputChatBox("Succesfully joined Lobby", 0, 200, 0, true) 
setElementData(localPlayer, "World", "Lobby") 
    triggerServerEvent("onPlayerLobbyEnter", getLocalPlayer())   
end 
end) 

server:

--#Freeroam World Functions 
addEvent("onPlayerFreeroamEnter", true)  
addEventHandler("onPlayerFreeroamEnter", getRootElement(), 
function() 
    setElementDimension(source, 0) 
    setElementInterior(source, 0) 
end) 
--#Stunt World Functions 
addEvent("onPlayerStuntEnter", true)  
addEventHandler("onPlayerStuntEnter", getRootElement(), 
function() 
    setElementDimension(source, 1) 
    setElementInterior(source, 0) 
end) 
--#Fun World Functions 
addEvent("onPlayerFunEnter", true)  
addEventHandler("onPlayerFunEnter", getRootElement(), 
function() 
    setElementDimension(source, 2) 
    setElementInterior(source, 0) 
end) 

Link to comment
  • Moderators

Ok so first, it didn't take you only 10 minutes, then your code is just the begining, because you need to modify the gamemodes that you want to make them work in only one world. Additionnaly, I would use only one event for the world selection.

Link to comment
Ok so first, it didn't take you only 10 minutes, then your code is just the begining, because you need to modify the gamemodes that you want to make them work in only one world. Additionnaly, I would use only one event for the world selection.

I know, i did example to him.

And yes, i did it with 10 minutes, i took some functions from my own gamemode.

Link to comment

@Hypex: I think it's obvious, that it's edited. But Bonsai says the following:

You gotta create the gamemodes by urself. You can't use existing gamemodes like race for that.

Which is wrong, because all the race servers use the default race gamemode (some don't, because they wanted to revamp everything to correspond their own methods of making things), which obviously is edited. But the point is, you don't need to make your own, you just have to place enough stuff around to make it work with your own system.

@Citizen: His example was just to show how easy it is to make one. The rest is simply just edits to the gamemodes so that they only fetch the players within that gamemode, which on the other hand is just dimension or element data or whatever you use to do that. It's nothing "complex", as mentioned above...

Link to comment

Like i said, others might have a different perspective. I find it pretty complex. Perhaps cause i have a different method of dealing with something like this. But honestly, i guess segregating the different gamemodes among the players and creating a simple system to manage and handle all these gamemodes definitely seems like a better alternative. Wish, someone would have brought this topic up a month back lol.

Link to comment
@Hypex: I think it's obvious, that it's edited. But Bonsai says the following:
You gotta create the gamemodes by urself. You can't use existing gamemodes like race for that.

Which is wrong, because all the race servers use the default race gamemode (some don't, because they wanted to revamp everything to correspond their own methods of making things), which obviously is edited. But the point is, you don't need to make your own, you just have to place enough stuff around to make it work with your own system.

@Citizen: His example was just to show how easy it is to make one. The rest is simply just edits to the gamemodes so that they only fetch the players within that gamemode, which on the other hand is just dimension or element data or whatever you use to do that. It's nothing "complex", as mentioned above...

Using existing gamemodes like race and do all the editing seems way more complicated to me than just creating your own one.

Of course there are functions you can take from there without much editing, but basically just doing edits without knowing exactly what is done in every line and why, because you didn't write it, will cause much more trouble.

However, I only know the race gamemode, and its in my opinion not worth to be used for that, since there is a lot of weird stuff inside which can be handled much easier.

Link to comment
I wouldn't call it complex at all. You can even make a system like that in five minutes or less depending on your needs. Simply put, you create a system that divides gamemodes into dimensions.

If you want to use the default gamemodes in it, that's not a problem, you just have to check the player's gamemode and only trigger events and functions for those that are in that specific gamemode. There's nothing more to that really.

@Bonsai: Well, since you're the expert - how did FFS got it to work with the default race script? Because they did, and there was no need to make their own.

Yep. That will definitely work. NOT. But what do I know about multigamemodes anyway...

Link to comment
I wouldn't call it complex at all. You can even make a system like that in five minutes or less depending on your needs. Simply put, you create a system that divides gamemodes into dimensions.

If you want to use the default gamemodes in it, that's not a problem, you just have to check the player's gamemode and only trigger events and functions for those that are in that specific gamemode. There's nothing more to that really.

@Bonsai: Well, since you're the expert - how did FFS got it to work with the default race script? Because they did, and there was no need to make their own.

I'm not sure if you are trolling or actually serious about what you are saying.

Therefore, I won't pay attention to this topic anymore.

Link to comment
I wouldn't call it complex at all. You can even make a system like that in five minutes or less depending on your needs. Simply put, you create a system that divides gamemodes into dimensions.

If you want to use the default gamemodes in it, that's not a problem, you just have to check the player's gamemode and only trigger events and functions for those that are in that specific gamemode. There's nothing more to that really.

@Bonsai: Well, since you're the expert - how did FFS got it to work with the default race script? Because they did, and there was no need to make their own.

Yep. That will definitely work. NOT. But what do I know about multigamemodes anyway...

Not like I haven't made three lobbies in my life.

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