Jump to content

Need help for script


Timoow13

Recommended Posts

Hi,

I wanted to make a script today so a marker will be created and when you hit the marker it shows a GUI and something in the chatbox, only for that player. When he types /close, the GUI closes and something has to appear in the chatbox, also to only that player. I'm not a very skilled scripter and I ran into a problem: all the GUI-functions are clientside and the chatbox-thing is serverside (if you want the message only appear to the player in the marker). What do I have to do now? I now have this (it doesn't work, the text when entering doesn't appear, the text when typing close is there, but I think it is visible to everyone, not sure though):

Clientside

GUIEditor = { 
    memo = {}, 
    window = {}, 
    tab = {}, 
    label = {}, 
    tabpanel = {}, 
} 
GUIEditor.window[1] = guiCreateWindow(559, 209, 616, 468, "Welcome to Da.ESCaPE!", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.tabpanel[1] = guiCreateTabPanel(22, 25, 585, 434, false, GUIEditor.window[1]) 
  
GUIEditor.tab[3] = guiCreateTab("Intro", GUIEditor.tabpanel[1]) 
  
GUIEditor.memo[4] = guiCreateMemo(7, 10, 582, 234, "Welcome to Da.ESCaPE (Dutch and English Server Clan and Playing Evolution)! This is a Dutch/English server clan with servers on Multi Theft Auto, Garry's Mod and Team Fortress 2. Our goal is to make our servers as unique as possible. In this windows you will find the rules, help, who is in our team, our other servers and credits.\n\n---To close this window, type /close---", false, GUIEditor.tab[3]) 
guiMemoSetReadOnly(GUIEditor.memo[4], true) 
  
GUIEditor.tab[4] = guiCreateTab("Rules", GUIEditor.tabpanel[1]) 
GUIEditor.tab[5] = guiCreateTab("Help", GUIEditor.tabpanel[1]) 
GUIEditor.tab[6] = guiCreateTab("The Team", GUIEditor.tabpanel[1]) 
GUIEditor.tab[7] = guiCreateTab("Servers", GUIEditor.tabpanel[1]) 
GUIEditor.tab[8] = guiCreateTab("Credits", GUIEditor.tabpanel[1]) 
  
infomarker = createMarker (415.29998779297, -2080.8000488281, 6.8000001907349, "cylinder", 1, 139, 127, 0, 100) 
  
addEventHandler ("onClientMarkerHit", infomarker, 
    function () 
        guiSetVisible(GUIEditor.window[1],true) 
        showCursor(true) 
    end 
) 
  
addCommandHandler ("close", 
    function () 
        guiSetVisible(GUIEditor.window[1],false) 
        showCursor(false) 
    end 
) 

Serverside

addEventHandler ("onMarkerHit", infomarker, 
    function () 
        outputChatBox("Freek: #FFFF00Hello! Can I help you?", getRootElement(), 0, 255, 0, true) 
    end 
) 
  
addCommandHandler ("close", 
    function () 
        outputChatBox("Freek: #FFFF00Come again when you need help! Have fun!", getRootElement(), 0, 255, 0, true) 
    end 
) 

I know this is a stupid question, but at least I'm trying. Please don't awnser with "we're not going to make scripts for you, blabla, you have to do that yourself, herpderp". I'm just asking.

Also, when I join the server the GUI pops up without me in the marker. I had this problem before with other GUI scripts. Anyone know a solution for this?

Thanks!

Link to comment

Cancel the server side file and just use it client side here you are try it :

GUIEditor = { 
    memo = {}, 
    window = {}, 
    tab = {}, 
    label = {}, 
    tabpanel = {}, 
} 
GUIEditor.window[1] = guiCreateWindow(559, 209, 616, 468, "Welcome to Da.ESCaPE!", false) 
guiSetVisible(GUIEditor.window[1],false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
  
GUIEditor.tabpanel[1] = guiCreateTabPanel(22, 25, 585, 434, false, GUIEditor.window[1]) 
  
GUIEditor.tab[3] = guiCreateTab("Intro", GUIEditor.tabpanel[1]) 
  
GUIEditor.memo[4] = guiCreateMemo(7, 10, 582, 234, "Welcome to Da.ESCaPE (Dutch and English Server Clan and Playing Evolution)! This is a Dutch/English server clan with servers on Multi Theft Auto, Garry's Mod and Team Fortress 2. Our goal is to make our servers as unique as possible. In this windows you will find the rules, help, who is in our team, our other servers and credits.\n\n---To close this window, type /close---", false, GUIEditor.tab[3]) 
guiMemoSetReadOnly(GUIEditor.memo[4], true) 
  
GUIEditor.tab[4] = guiCreateTab("Rules", GUIEditor.tabpanel[1]) 
GUIEditor.tab[5] = guiCreateTab("Help", GUIEditor.tabpanel[1]) 
GUIEditor.tab[6] = guiCreateTab("The Team", GUIEditor.tabpanel[1]) 
GUIEditor.tab[7] = guiCreateTab("Servers", GUIEditor.tabpanel[1]) 
GUIEditor.tab[8] = guiCreateTab("Credits", GUIEditor.tabpanel[1]) 
  
local infomarker = createMarker (415.29998779297, -2080.8000488281, 6.8000001907349, "cylinder", 1, 139, 127, 0, 100) 
  
addEventHandler ("onClientMarkerHit", infomarker, 
    function (player) 
  if ( player == localPlayer ) then 
        guiSetVisible(GUIEditor.window[1],true) 
        showCursor(true) 
     outputChatBox("Freek: #FFFF00Hello! Can I help you?",0, 255, 0, true) 
            end 
end 
) 
  
addCommandHandler ("close", 
    function () 
        guiSetVisible(GUIEditor.window[1],false) 
        showCursor(false) 
        outputChatBox("Freek: #FFFF00Come again when you need help! Have fun!", 0, 255, 0, true) 
    end 
) 
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...