Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 Still not freakin working O_O You're wrong, it works for me. Just type in /ovp Link to comment
GerardWay Posted January 25, 2013 Author Share Posted January 25, 2013 Well Lloyd Logan can you provide me with the Meta you are currently using for it please? And thanks Castillo, will try that in a sec Link to comment
Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 Well Lloyd Logan can you provide me with the Meta you are currently using for it please?And thanks Castillo, will try that in a sec type="script" version="1.0.0" name="HelpForum" description="meh" /> Link to comment
Anderl Posted January 25, 2013 Share Posted January 25, 2013 Client side: local GUI_Buttons = {} local GOD_STR = "" local elementID = { [TURISMO_ID] = { type = "vehicle", name = "Turismo", positions = { 17, 80, 130, 59 } }, [HYDRA_ID] = { type = "vehicle", name = "Hydra", positions = { 173, 80, 132, 57 } }, [CHAINSAW_ID] = { type = "vehicle", name = "Chainsaw", positions = { 17, 176, 127, 58 } }, [RPG_ID] = { type = "weapon", name = "RPG", positions = { 163, 176, 138, 53 } }, [NRG500_ID] = { type = "weapon", name = "NRG-500", positions = { 12, 348, 124, 53 } } }; addEventHandler ( "onClientResourceStart", resourceRoot, function() --create window and other GUI elements p_Window = guiCreateWindow ( 0, 274, 331, 493, "V.I.P. Panel", false ); if ( p_Window ) then guiWindowSetSizable ( p_Window, false ); guiSetAlpha ( p_Window, 1 ); guiSetVisible ( p_Window, false ); showCursor ( false ); for index, value in pairs( vehicleID ) do local px, py, width, height = unpack ( value.positions ); GUI_Buttons[index] = guiCreateButton ( px, py, width, height, "Give " .. value.name, false, p_Window ); end --CHECK HERE WHETHER LOCAL PLAYERS GOD MODE IS ENABLED OR NOT AND SET GOD_STR TO "Enable GodMode" or "Disable GodMode" p_Godmode = guiCreateButton ( 10, 268, 129, 54, GOD_STR, false, p_Window ); p_Close = guiCreateButton ( 162, 352, 121, 49, "Close panel", false, p_Window ); --event/command handlers addEventHandler ( "onClientGUIClick", root, GUI_Click, false ); addCommandHandler ( "ovp", GUI_Visible ); end end ) function GUI_Click() for index, value in pairs( GUI_Buttons ) do if ( source == value ) then triggerServerEvent( "panel:createElement", localPlayer, value.type, index ); end end if ( source == p_Godmode ) then --check if god mode is enabled or not and do your things end if ( source == p_Close ) then guiSetVisible( p_Window, false ); showCursor ( false ); end end function GUI_Visible() guiSetVisible ( p_Window, not guiGetVisible( p_Window ) ); showCursor( guiGetVisible( p_Window ) ); end Server side: addEvent ( "panel:createElement", true ); addEventHandler ( "panel:createElement", root, function ( type, id ) if ( type == "vehicle" ) then local px, py, pz = getElementPosition ( source ); if ( px and py and pz ) then warpPedIntoVehicle ( source, createVehicle ( tonumber ( id ), px, py, pz + 2 ) ); end elseif ( type == "weapon" ) then giveWeapon ( source, id, 1, true ); end end ) Didn't test it, just wanted to show you an easier way to do what you want. To add a vehicle/weapon you simply need to do this: 1. Find out "elementID" array ( it's on top of the file ). 2. Between the { } add this: [ MODEL_ID ] = { type = "vehicle/weapon", name = "Name that will appear in the button", positions = { WRITE_HERE_POSX_POSY_WIDTH_HEIGHT_DIVIDED_BY_COMMAS_OF_THE_BUTTONS }, Example: --for vehicle: [411] = { type = "vehicle", name = "Infernus", positions = { 0, 0, 0, 0 } }, --for weapon: [38] = { type = "weapon", name = "Minigun", positions = { 0, 0, 0, 0 } }, P.S. You should look at comments in the code and edit it, otherwise code won't work properly. Link to comment
Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 Didn't test it, just wanted to show you an easier way to do what you want.To add a vehicle/weapon you simply need to do this: Thank you!! I hate doing the same function over and over again! On the other hand, did my script work for you Zombie? Link to comment
GerardWay Posted January 25, 2013 Author Share Posted January 25, 2013 Didnt Work Lloyd Link to comment
Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 Didnt Work Lloyd Post your script. Link to comment
GerardWay Posted January 25, 2013 Author Share Posted January 25, 2013 (edited) forumc.lua: addEventHandler("onClientResourceStart", resourceRoot, 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 ) 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 ) 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 ) forums.lua: 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 ) Edited January 27, 2013 by Guest Link to comment
Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 copy this forumc.lua 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 ) Link to comment
GerardWay Posted January 25, 2013 Author Share Posted January 25, 2013 Still nothin' EDIT: Its working fine now! Thanks so much! Could you please add a section of the script that makes the panel only openable for people in the "V.I.P" Team mate? Link to comment
Lloyd Logan Posted January 25, 2013 Share Posted January 25, 2013 Still nothin' What are you typing in? Add me on skype : lloydlogan11 Link to comment
iPrestege Posted January 25, 2013 Share Posted January 25, 2013 Client side: local GUI_Buttons = {} local GOD_STR = "" local elementID = { [TURISMO_ID] = { type = "vehicle", name = "Turismo", positions = { 17, 80, 130, 59 } }, [HYDRA_ID] = { type = "vehicle", name = "Hydra", positions = { 173, 80, 132, 57 } }, [CHAINSAW_ID] = { type = "vehicle", name = "Chainsaw", positions = { 17, 176, 127, 58 } }, [RPG_ID] = { type = "weapon", name = "RPG", positions = { 163, 176, 138, 53 } }, [NRG500_ID] = { type = "weapon", name = "NRG-500", positions = { 12, 348, 124, 53 } } }; addEventHandler ( "onClientResourceStart", resourceRoot, function() --create window and other GUI elements p_Window = guiCreateWindow ( 0, 274, 331, 493, "V.I.P. Panel", false ); if ( p_Window ) then guiWindowSetSizable ( p_Window, false ); guiSetAlpha ( p_Window, 1 ); guiSetVisible ( p_Window, false ); showCursor ( false ); for index, value in pairs( vehicleID ) do local px, py, width, height = unpack ( value.positions ); GUI_Buttons[index] = guiCreateButton ( px, py, width, height, "Give " .. value.name, false, p_Window ); end --CHECK HERE WHETHER LOCAL PLAYERS GOD MODE IS ENABLED OR NOT AND SET GOD_STR TO "Enable GodMode" or "Disable GodMode" p_Godmode = guiCreateButton ( 10, 268, 129, 54, GOD_STR, false, p_Window ); p_Close = guiCreateButton ( 162, 352, 121, 49, "Close panel", false, p_Window ); --event/command handlers addEventHandler ( "onClientGUIClick", root, GUI_Click, false ); addCommandHandler ( "ovp", GUI_Visible ); end end ) function GUI_Click() for index, value in pairs( GUI_Buttons ) do if ( source == value ) then triggerServerEvent( "panel:createElement", localPlayer, value.type, index ); end end if ( source == p_Godmode ) then --check if god mode is enabled or not and do your things end if ( source == p_Close ) then guiSetVisible( p_Window, false ); showCursor ( false ); end end function GUI_Visible() guiSetVisible ( p_Window, not guiGetVisible( p_Window ) ); showCursor( guiGetVisible( p_Window ) ); end Server side: addEvent ( "panel:createElement", true ); addEventHandler ( "panel:createElement", root, function ( type, id ) if ( type == "vehicle" ) then local px, py, pz = getElementPosition ( source ); if ( px and py and pz ) then warpPedIntoVehicle ( source, createVehicle ( tonumber ( id ), px, py, pz + 2 ) ); end elseif ( type == "weapon" ) then giveWeapon ( source, id, 1, true ); end end ) Didn't test it, just wanted to show you an easier way to do what you want. To add a vehicle/weapon you simply need to do this: 1. Find out "elementID" array ( it's on top of the file ). 2. Between the { } add this: [ MODEL_ID ] = { type = "vehicle/weapon", name = "Name that will appear in the button", positions = { WRITE_HERE_POSX_POSY_WIDTH_HEIGHT_DIVIDED_BY_COMMAS_OF_THE_BUTTONS }, Example: --for vehicle: [411] = { type = "vehicle", name = "Infernus", positions = { 0, 0, 0, 0 } }, --for weapon: [38] = { type = "weapon", name = "Minigun", positions = { 0, 0, 0, 0 } }, P.S. You should look at comments in the code and edit it, otherwise code won't work properly. Awesome!And easy!^ ^ Link to comment
Lloyd Logan Posted January 27, 2013 Share Posted January 27, 2013 Still nothin'EDIT: Its working fine now! Thanks so much! Could you please add a section of the script that makes the panel only openable for people in the "V.I.P" Team mate? My pleasure, done it through skype! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now