Jump to content

[help] Button Function


Recommended Posts

Posted

ClientSide:

GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(2, 2, 798, 598, "MTA TORCIDAS 1.0", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(185, 35, 452, 119, ":paineltimes/pluss.png", false, GUIEditor.window[1]) 
  
        GUIEditor.staticimage[2] = guiCreateStaticImage(564, 303, 39, 40, ":paineltimes/figueirense.png", false, GUIEditor.staticimage[1]) 
  
        GUIEditor.label[1] = guiCreateLabel(261, 164, 446, 55, "Selecione seu time", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "sa-gothic") 
        GUIEditor.button[1] = guiCreateButton(29, 340, 122, 39, "Botafogo", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF") 
        guiSetFont(GUIEditor.label[2], "sa-header") 
        GUIEditor.staticimage[23] = guiCreateStaticImage(163, 243, 39, 31, ":paineltimes/corintians.png", false, GUIEditor.window[1])   
        showCursor(true) 
        guiSetVisible(window,true)   
    end 
) 
  
  
bindKey ( "F2", "down", function ( ) 
    local tostate = not guiGetVisible ( GUIEditor.window[1] ) 
    guiSetVisible ( GUIEditor.window[1], tostate ) 
    showCursor ( tostate ) 
end ) 
  
function teleportPlayer() 
    if(source == GUIEditor.button[1]) then 
    local teleportX, teleportY, teleportZ = 1479.6, -1612.8, 14.0 
        triggerServerEvent("movePlayerToBotafogo", getLocalPlayer(), getLocalPlayer(), teleportX, teleportY, teleportZ) 
        showCursor(false) 
        guiSetVisible(GUIEditor.window[1],false) 
        outputChatBox("Bem vindo ao botafogo!") 
    end 
end 
addEventHandler("onClientGUIClick", root, teleportPlayer) 
  
addEventHandler('onClientGUIClick',GUIEditor.button[1], 
    function (  ) 
        triggerServerEvent('LoadServer',localPlayer) 
        guiSetVisible (GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
        showCursor (false) 
      outputChatBox("Bem vindo ao botafogo!") 
    end,false 
) 
  
  
  
  
  

I took the other buttons because the client only need this!

Serverside:

function teleportPlayer() 
    if(source == GUIEditor.button[1]) then 
    local teleportX, teleportY, teleportZ = 1479.6, -1612.8, 14.0 
        setElementPosition(getLocalPlayer(), teleportX, teleportY, teleportZ) 
    end 
end 
addEventHandler("onClientGUIClick", root, teleportPlayer) 
  
addEvent('LoadServer',true) 
addEventHandler('LoadServer',root, 
    function (  ) 
        setElementPosition ( source,1479.6, -1612.8, 14.0 ) 
        setElementModel ( source,0 ) 
    end 
) 

Posted
GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(2, 2, 798, 598, "MTA TORCIDAS 1.0", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(185, 35, 452, 119, ":paineltimes/pluss.png", false, GUIEditor.window[1]) 
  
        GUIEditor.staticimage[2] = guiCreateStaticImage(564, 303, 39, 40, ":paineltimes/figueirense.png", false, GUIEditor.staticimage[1]) 
  
        GUIEditor.label[1] = guiCreateLabel(261, 164, 446, 55, "Selecione seu time", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "sa-gothic") 
        GUIEditor.button[1] = guiCreateButton(29, 340, 122, 39, "Botafogo", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF") 
        guiSetFont(GUIEditor.label[2], "sa-header") 
        addEventHandler('onClientGUIClick',GUIEditor.button[1],setSkin,false) 
        GUIEditor.staticimage[23] = guiCreateStaticImage(163, 243, 39, 31, ":paineltimes/corintians.png", false, GUIEditor.window[1])   
        showCursor(true) 
        guiSetVisible(window,true)  
    end 
) 
  
  
bindKey ( "F2", "down", function ( ) 
    local tostate = not guiGetVisible ( GUIEditor.window[1] ) 
    guiSetVisible ( GUIEditor.window[1], tostate ) 
    showCursor ( tostate ) 
end ) 
  
function teleportPlayer() 
    if(source == GUIEditor.button[1]) then 
    local teleportX, teleportY, teleportZ = 1479.6, -1612.8, 14.0 
        triggerServerEvent("movePlayerToBotafogo", getLocalPlayer(), getLocalPlayer(), teleportX, teleportY, teleportZ) 
        showCursor(false) 
        guiSetVisible(GUIEditor.window[1],false) 
        outputChatBox("Bem vindo ao botafogo!") 
    end 
end 
addEventHandler("onClientGUIClick", root, teleportPlayer) 
  
function setSkin ( ) 
    triggerServerEvent('LoadServer',localPlayer) 
    guiSetVisible (GUIEditor.window[1], not guiGetVisible ( GUIEditor.window[1] ) ) 
    showCursor (false) 
    outputChatBox("Bem vindo ao botafogo!") 
end 

Posted

so must its a bug on my server, Please pass me the client and the server that panel to see if it was not me that bug

or pass me the entire script panel by skype

Posted

-- client side:

GUIEditor = { 
    button = {}, 
    window = {}, 
    staticimage = {}, 
    label = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(2, 2, 798, 598, "MTA TORCIDAS 1.0", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
        GUIEditor.staticimage[1] = guiCreateStaticImage(185, 35, 452, 119, ":paineltimes/pluss.png", false, GUIEditor.window[1]) 
  
        GUIEditor.staticimage[2] = guiCreateStaticImage(564, 303, 39, 40, ":paineltimes/figueirense.png", false, GUIEditor.staticimage[1]) 
  
        GUIEditor.label[1] = guiCreateLabel(261, 164, 446, 55, "Selecione seu time", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "sa-gothic") 
        GUIEditor.button[1] = guiCreateButton(29, 340, 122, 39, "Botafogo", false, GUIEditor.window[1]) 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFFFFFF") 
        guiSetFont(GUIEditor.label[2], "sa-header") 
        addEventHandler('onClientGUIClick',GUIEditor.button[1],setSkin,false) 
        GUIEditor.staticimage[23] = guiCreateStaticImage(163, 243, 39, 31, ":paineltimes/corintians.png", false, GUIEditor.window[1])   
        showCursor(true) 
        guiSetVisible(window,true) 
    end 
) 
  
bindKey ( "F2", "down", 
    function ( ) 
        local tostate = not guiGetVisible ( GUIEditor.window[1] ) 
        guiSetVisible ( GUIEditor.window[1], tostate ) 
        showCursor ( tostate ) 
    end 
) 
  
function setSkin ( ) 
    triggerServerEvent('LoadServer',localPlayer) 
    guiSetVisible (GUIEditor.window[1], false) 
    showCursor (false) 
    outputChatBox("Bem vindo ao botafogo!") 
end 

-- server side:

addEvent('LoadServer',true) 
addEventHandler('LoadServer',root, 
    function (  ) 
        setElementPosition ( source,1479.6, -1612.8, 14.0 ) 
        setElementModel ( source,0 ) 
    end 
) 

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