Jump to content

Panel Problem


GerardWay

Recommended Posts

Posted

I have just created a V.I.P Panel using the GUI Editor, and I was wondering if anyone could give me an example of how to make one of the functions work, like how I would make the player recieve a hydra when they click a Button on the panel named "Give Hydra".

Any help would be great thanks!

Code:

GUIEditor = { 
    button = {}, 
    window = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0, 274, 331, 493, "V.I.P Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
         
Turismo = guiCreateButton(17, 80, 130, 59, "Give Turismo", false, GUIEditor.window[1]) 
         
Hydra = guiCreateButton(173, 80, 132, 57, "Give Hydra", false, GUIEditor.window[1]) 
         
Chainsaw = guiCreateButton(17, 176, 127, 58, "Give Chainsaw", false, GUIEditor.window[1]) 
         
RPG = guiCreateButton(163, 176, 138, 53, "Give RPG x20", false, GUIEditor.window[1]) 
         
EnableGodmode = guiCreateButton(10, 268, 129, 54, "Enable Godmode", false, GUIEditor.window[1]) 
         
DisableGodmode = guiCreateButton(162, 268, 126, 49, "Disable Godmode", false, GUIEditor.window[1]) 
         
NRG-500 = guiCreateButton(12, 348, 124, 53, "Give NRG-500", false, GUIEditor.window[1]) 
         
Close = guiCreateButton(162, 352, 121, 49, "Close Panel", false, GUIEditor.window[1])     
     
  
  
end 
) 
  

560x95_FFFFFF_FF9900_000000_000000.png
Posted

onClientGUIClick

triggerServerEvent 
addEvent 
addEventHandler 
getElementPosition 
createVehicle 
warpPedIntoVehicle 

That's all you need to do it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Try to do it, and if it doesn't work, post your script and I'll help you.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted (edited)

CLIENT

GUIEditor = { 
    button = {}, 
    window = {}, 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0, 274, 331, 493, "V.I.P Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
         
Turismo = guiCreateButton(17, 80, 130, 59, "Give Turismo", false, GUIEditor.window[1]) 
         
Hydra = guiCreateButton(173, 80, 132, 57, "Give Hydra", false, GUIEditor.window[1]) 
         
Chainsaw = guiCreateButton(17, 176, 127, 58, "Give Chainsaw", false, GUIEditor.window[1]) 
         
RPG = guiCreateButton(163, 176, 138, 53, "Give RPG x20", false, GUIEditor.window[1]) 
         
EnableGodmode = guiCreateButton(10, 268, 129, 54, "Enable Godmode", false, GUIEditor.window[1]) 
         
DisableGodmode = guiCreateButton(162, 268, 126, 49, "Disable Godmode", false, GUIEditor.window[1]) 
         
NRG500 = guiCreateButton(12, 348, 124, 53, "Give NRG-500", false, GUIEditor.window[1]) 
addEventHandler ("onClientGUIClick", NRG500, buyCar, false ) 
         
Close = guiCreateButton(162, 352, 121, 49, "Close Panel", false, GUIEditor.window[1])     
  
function buyCar(thePlayer) 
    triggerServerEvent ( "buyVeh", getLocalPlayer(), "greetingHandler" ) 
      end 
end 
) 
  

SERVER

function greetingHandler ( thePlayer ) 
                 createVehicle(522, 1944.60632, -1706.89270, 13.38281)end 
addEvent( "buyVeh", true ) 
addEventHandler( "buyVeh", getRootElement(), greetingHandler ) 

Edited by Guest

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

That won't work.

@Zombie: You can't use "-" character while defining a variable, like here: "NRG-500".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
That won't work.

@Zombie: You can't use "-" character while defining a variable, like here: "NRG-500".

Edited**

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

--Client Side--

  
  
GUIEditor = { 
    button = {}, 
    window = {}, 
} 
        GUIEditor.window[1] = guiCreateWindow(0, 274, 331, 493, "V.I.P Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
  
         
Turismo = guiCreateButton(17, 80, 130, 59, "Give Turismo", false, GUIEditor.window[1]) 
         
Hydra = guiCreateButton(173, 80, 132, 57, "Give Hydra", false, GUIEditor.window[1]) 
         
Chainsaw = guiCreateButton(17, 176, 127, 58, "Give Chainsaw", false, GUIEditor.window[1]) 
         
RPG = guiCreateButton(163, 176, 138, 53, "Give RPG x20", false, GUIEditor.window[1]) 
         
EnableGodmode = guiCreateButton(10, 268, 129, 54, "Enable Godmode", false, GUIEditor.window[1]) 
         
DisableGodmode = guiCreateButton(162, 268, 126, 49, "Disable Godmode", false, GUIEditor.window[1]) 
         
NRG-500 = guiCreateButton(12, 348, 124, 53, "Give NRG-500", false, GUIEditor.window[1]) 
         
Close = guiCreateButton(162, 352, 121, 49, "Close Panel", false, GUIEditor.window[1])     
     
addEventHandler("onClientGUIClick", root, 
 function() 
  if source == Turismo then 
    triggerServerEvent("Turismo", localPlayer) 
  elseif source == Hydra then 
    triggerServerEvent("Hydra", localPlayer) 
 elseif source == Chainsaw then 
    triggerServerEvent("Chainsaw", localPlayer) 
  elseif source == NRG-500 then 
    triggerServerEvent("NRG-500", localPlayer) 
  elseif source == Close then 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
    end 
  end 
) 
  
  
  

--Server Side--

addEvent( "Turismo", true) 
addEventHandler( "Turismo", root, 
    function()                       
       x,y,z = getElementPosition ( source ) 
        Vehicle = createVehicle ( id, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
addEvent( "Hydra", true) 
addEventHandler( "Hydra", root, 
    function()                       
       x,y,z = getElementPosition ( source ) 
        Vehicle = createVehicle ( id, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
addEvent( "NRG-500", true) 
addEventHandler( "NRG-500", root, 
    function()                       
       x,y,z = getElementPosition ( source ) 
        Vehicle = createVehicle ( id, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
addEvent( "Chainsaw", true) 
addEventHandler( "Chainsaw", root, 
    function()                       
       x,y,z = getElementPosition ( source ) 
        Vehicle = createVehicle ( id, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  

i Do The Vehicle Only the others i dont understand it realy! and the close button!Just Change the Vehicle id

  

Posted

You should have read what Solidsnake14 said to Lloyd Logan and also your code should be better organised, it's a lot boring to add multiple if statements for multiple vehicles and to add multiple events for creating each vehicle. You should make ONLY ONE event to create any vehicle and use arrays.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted
You should have read what Solidsnake14 said to Lloyd Logan and also your code should be better organised, it's a lot boring to add multiple if statements for multiple vehicles and to add multiple events for creating each vehicle. You should make ONLY ONE event to create any vehicle and use arrays.

This will be easier for him as a Beginner! :)

  

Posted

My way is much easier and faster to do than yours. Also, if he ever needed to change/add vehicles, he would simply add to the array.

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

I really don't understand why did you had to make the code for him at all, is not as helpful as letting him try to do it.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
I really don't understand why did you had to make the code for him at all, is not as helpful as letting him try to do it.

it,s just , a simple example :) and he will know how i do it! and you zombie if you have any question ask me Np!.

  

Posted
The panel isnt even showing now, im guessing that maybe it could be a problem with "GUISetvisible" ?

Yes, put in [lua]guiSetVisible(windowhere**, true)[\lua]

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
addCommandHandler("ovp", Panel,

guiSetVisible(Panel, true)

I added that and it didnt work

Post your script

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
  
function showit ( ) 
guiSetVisible( GUIEditor.window[1], true ) 
showCursor( true ) 
end 
addCommandHandler( "showit", showit ) 
  

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted

It's the same code as Samers, just different command name lol

"[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007

Posted

Remember the command is ovp

--CLIENT

  
GUIEditor = { 
  
    button = {}, 
  
    window = {}, 
  
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(0, 274, 331, 493, "V.I.P Panel", false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetAlpha(GUIEditor.window[1], 1.00) 
        guiSetVisible( GUIEditor.window[1], false ) 
         
  
Turismo = guiCreateButton(17, 80, 130, 59, "Give Turismo", false, GUIEditor.window[1]) 
  
         
  
Hydra = guiCreateButton(173, 80, 132, 57, "Give Hydra", false, GUIEditor.window[1]) 
  
         
  
Chainsaw = guiCreateButton(17, 176, 127, 58, "Give Chainsaw", false, GUIEditor.window[1]) 
  
         
  
RPG = guiCreateButton(163, 176, 138, 53, "Give RPG x20", false, GUIEditor.window[1]) 
  
         
  
EnableGodmode = guiCreateButton(10, 268, 129, 54, "Enable Godmode", false, GUIEditor.window[1]) 
  
         
  
DisableGodmode = guiCreateButton(162, 268, 126, 49, "Disable Godmode", false, GUIEditor.window[1]) 
  
         
  
NRG500 = guiCreateButton(12, 348, 124, 53, "Give NRG-500", false, GUIEditor.window[1]) 
  
  
Close = guiCreateButton(162, 352, 121, 49, "Close Panel", false, GUIEditor.window[1])     
  
showCursor( false ) 
  
function buyCar(thePlayer) 
    triggerServerEvent ( "buyVeh", getLocalPlayer(), "greetingHandler" ) 
      end 
end 
) 
  
  
  
addEventHandler("onClientGUIClick", root, 
 function() 
  if source == Turismo then 
    triggerServerEvent("Turismo", localPlayer) 
  elseif source == Hydra then 
    triggerServerEvent("Hydra", localPlayer) 
 elseif source == Chainsaw then 
    triggerServerEvent("Chainsaw", localPlayer) 
 elseif source == RPG then 
    triggerServerEvent("RPG", localPlayer) 
  elseif source == NRG500 then 
    triggerServerEvent("NRG500", localPlayer) 
  elseif source == Close then 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
    end 
  end 
) 
  
function showit ( ) 
guiSetVisible( GUIEditor.window[1], true ) 
showCursor( true ) 
end 
addCommandHandler( "ovp", showit ) 
  

--SERVER

  
addEvent( "Turismo", true) 
addEventHandler( "Turismo", root, 
    function()                       
       x, y, z = getElementPosition ( source ) 
        Vehicle = createVehicle ( 451, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
  
  
addEvent( "Hydra", true) 
addEventHandler( "Hydra", root, 
    function()                       
       x, y, z = getElementPosition ( source ) 
        Vehicle = createVehicle ( 520, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
  
  
addEvent( "NRG500", true) 
addEventHandler( "NRG500", root, 
    function()                       
       x, y, z = getElementPosition ( source ) 
        Vehicle = createVehicle ( 522, x, y, z + 2) 
        warpPedIntoVehicle ( source, Vehicle ) 
    end 
) 
  
addEvent( "RPG", true) 
addEventHandler( "RPG", root, 
    function()                       
    giveWeapon( root, 35, 1, true ) 
    end 
) 
  
  
  
addEvent( "Chainsaw", true) 
addEventHandler( "Chainsaw", root, 
    function()                       
        giveWeapon( root, 9, 1, true ) 
    end 
) 
  
  

If you need an Intermediate scripter feel free to PM me as I will accept "almost" any job, STATUS: UNAVAILABLE

SCOTLAND, my hometown, and the Home of GTA!

Posted
function buyCar(thePlayer) 
    triggerServerEvent ( "buyVeh", getLocalPlayer(), "greetingHandler" ) 
      end 
end 
) 

Remove that ")" after the last "end".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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