Jump to content

[HELP] GUI Button does not work


BolonZX

Recommended Posts

Posted

Well I'm trying to make a car panel for my server I already created the server and client scripts but whenerver I click on the button nothing happens I did debugscript 3 and it shows no errors here is the code:

server

function nissann ( thePlayer ) 
local account = getAccountName ( getPlayerAccount ( thePlayer ) ) 
if isObjectInACLGroup ("user."..account, aclGetGroup ( "TougeRushers" ) ) then 
  local xp,yp,zp = getElementPosition ( thePlayer ) 
   createVehicle ( 426, x, y, z + 10 ) 
   outputChatBox ( "Aqui esta su vehiculo BolonZX", thePlayer ) 
 else 
  blowVehicle ()  
  outputChatBox ( "Este Vehiculo pertenece a BolonZX", thePlayer ) 
end 
end 
addEvent( "OnNissanEnter", true ) 
addEventHandler( "OnNissanEnter", getRootElement(), nissann ) 

client

function touge() 
        PanelTouge = guiCreateWindow ( 341, 204, 292, 495, "TougeRushers Carros", false ) 
        guiSetProperty(PanelTouge, "CaptionColour", "FFD90000") 
        guiWindowSetSizable(PanelTouge, false) 
        showCursor (true) 
         
        nissanr32 = guiCreateButton(24, 41, 63, 46, "Nissan Skyline GTR R32", false, PanelTouge) 
        brz = guiCreateButton(24, 101, 63, 46, "Subaru BRZ", false, PanelTouge) 
        nissanr35 = guiCreateButton(24, 161, 63, 46, "Nissan Skyline GTR R35", false, PanelTouge) 
        memotext = guiCreateMemo(39, 432, 203, 53, "Estos son los carros oficiales del\nequipo |TougeRushers|", false, PanelTouge) 
        guiMemoSetReadOnly(memotext, true) 
  
        showCursor (true) 
        addEventHandler ( "OnClientGUIClick", nissanr32, nissann, false )  
end 
addCommandHandler ("tougecars", touge) 
  
function nissann () 
showCursor (true) 
triggerServerEvent ( "OnNissanEnter", getLocalPlayer() ) 
end 

In-game name: |-FMJ-|

Posted

There may be more errors, but the only one I found was you needed another "getLocalPlayer ( )"

function touge() 
    PanelTouge = guiCreateWindow ( 341, 204, 292, 495, "TougeRushers Carros", false ) 
    guiSetProperty(PanelTouge, "CaptionColour", "FFD90000") 
    guiWindowSetSizable(PanelTouge, false) 
    showCursor (true) 
        
    nissanr32 = guiCreateButton(24, 41, 63, 46, "Nissan Skyline GTR R32", false, PanelTouge) 
    brz = guiCreateButton(24, 101, 63, 46, "Subaru BRZ", false, PanelTouge) 
    nissanr35 = guiCreateButton(24, 161, 63, 46, "Nissan Skyline GTR R35", false, PanelTouge) 
    memotext = guiCreateMemo(39, 432, 203, 53, "Estos son los carros oficiales del\nequipo |TougeRushers|", false, PanelTouge) 
    guiMemoSetReadOnly(memotext, true) 
  
    showCursor (true) 
    addEventHandler ( "OnClientGUIClick", nissanr32, nissann, false ) 
end 
addCommandHandler ("tougecars", touge) 
  
function nissann () 
    showCursor (true) 
    triggerServerEvent ( "OnNissanEnter", getLocalPlayer ( ), getLocalPlayer ( ) ) 
end 

Posted

Client

  
function touge() 
    PanelTouge = guiCreateWindow ( 341, 204, 292, 495, "TougeRushers Carros", false ) 
    guiSetProperty(PanelTouge, "CaptionColour", "FFD90000") 
    guiWindowSetSizable(PanelTouge, false) 
    guiSetVisible(PanelTouge, false) 
     
    nissanr32 = guiCreateButton(24, 41, 63, 46, "Nissan Skyline GTR R32", false, PanelTouge) 
    brz = guiCreateButton(24, 101, 63, 46, "Subaru BRZ", false, PanelTouge) 
    nissanr35 = guiCreateButton(24, 161, 63, 46, "Nissan Skyline GTR R35", false, PanelTouge) 
    memotext = guiCreateMemo(39, 432, 203, 53, "Estos son los carros oficiales del\nequipo |TougeRushers|", false, PanelTouge) 
    guiMemoSetReadOnly(memotext, true) 
     
    addEventHandler ( "onClientGUIClick", nissanr32, nissann, false ) 
    addCommandHandler("tougecars", toggleWindow) 
end 
addEventHandler("onClientResourceStart", resourceRoot, touge) 
  
function toggleWindow() 
    guiSetVisible(PanelTouge, not guiGetVisible(PanelTouge)) 
    showCursor(guiGetVisible(PanelTouge)) 
end 
  
function nissann() 
    triggerServerEvent ( "OnNissanEnter", getLocalPlayer() ) 
    toggleWindow() 
end 

Server

  
function nissann () 
local account = getAccountName ( getPlayerAccount ( source ) ) 
    if isObjectInACLGroup ("user."..account, aclGetGroup ( "TougeRushers" ) ) then 
        local xp,yp,zp = getElementPosition ( source ) 
        createVehicle ( 426, xp, yp, zp + 10 ) 
        outputChatBox ( "Aqui esta su vehiculo BolonZX", source ) 
    else 
        outputChatBox ( "Este Vehiculo pertenece a BolonZX", source ) 
    end 
end 
addEvent( "OnNissanEnter", true ) 
addEventHandler( "OnNissanEnter", getRootElement(), nissann ) 

Please do not PM me with scripting related question nor support, use the forums instead.

Posted

I've tested and it worked for me.

Try copying my code again.

Please do not PM me with scripting related question nor support, use the forums instead.

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