Jump to content

Start gamemode as resource for the local player


papam77

Recommended Posts

Posted

Hello, i have problem with lobby i am trying to setElementData ( player, xxxxxxxxxxxxxxxxxxxx) but when i add race to lobby meta then race start before lobby i wanna start race for the local player when he click to the button.

How can do it?

dm.lua

   addEvent ("moveToDM", true) 
   function moveToDM() 
    local dm = { 
    ["dm"]= guiCreateStaticImage(0.157, 0.19, 0.17, 0.305, "images/areny/dm.png", true, arenas, lobby), 
    } 
    guiSetAlpha ( dm["dm"], 0.75 ) 
    
    addEventHandler( "onClientMouseEnter", root, 
    function(aX, aY) 
    for key,gui in pairs (dm) do 
              if gui == source then 
                  guiSetAlpha ( source, 1 ) 
                  playSound("sound/btn.mp3") 
                  return 
              end 
        end 
    end 
    ) 
    
    addEventHandler( "onClientMouseLeave", root, 
    function(aX, aY) 
    for key,gui in pairs (dm) do 
              if gui == source then 
              guiSetAlpha ( source, 0.75 ) 
                  return 
              end 
        end 
    end 
    ) 
    
    addEventHandler ( "onClientGUIClick", dm["dm"], moveToDM2, false ) 
    end 
    function moveToDM2(button) 
    if button == "left" then 
    setElementData (player,"gamemode","[gamemodes]/[race]/race", true) 
    setElementDimension (2) 
    outputChatBox ("You have been move to DM!") 
        playSound ( "sound/click.mp3" ) 
        end     
    end 
    addEventHandler("moveToDM", getRootElement(), moveToDM) 
  

Posted (edited)

Also you missed end for the function "moveToDM"

and you put two events for the function "moveToDM2"

and you put end under the event "onClientGuiClick"

Edited by Guest
Posted

Yes, but race gamemode must be start for move to the race, you can't move to race if race isn't started.

And if i start the race it is before lobby. :(

btw: Why event for moveToDM2 ?

It work correctly when i click "You have been move to DM!"

But only doesn't move me to DM because dm isn't started.

Posted

Multtgamemode is a singel game mode like race , but he have multiple game's inside. You can't just start race gamemode for one player and for the other one the play gamemode...........

You need to recreate the whole gamemode's in one gamemode .

Posted

bandi94: No, there are other approaches you can take to do it (there is a very easy one which I once used).

papam77: Don't attempt to copy it - you don't have the knowledge for it nor are you going to win a medal for that (even if you ever do it, it will probably be no bug-free thing).

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