Sande Posted April 18, 2014 Share Posted April 18, 2014 I started to code vip-panel gui for my server. But i have problem, the check are the player vip works but when it execute a clientTriggerEvent command the panel does not open. Serverside: function openVIPPanel(thePlayer) if getAccountData(getPlayerAccount(thePlayer), "vip" ) == 1 then triggerClientEvent (thePlayer, "vipPanelOpen", thePlayer) exports["ac-message"]:outputTopBar("VIP: Panel opened!", thePlayer,0,255,0) else exports["ac-message"]:outputTopBar("VIP: You are not vip!", thePlayer,255,0,0) end end addCommandHandler("vip", openVIPPanel ) Clientside: function gui() vipPanel.window[1] = guiCreateWindow(498, 140, 365, 632, "Suomisu - VIP Panel", false) guiWindowSetSizable(vipPanel.window[1], false) vipPanel.label[1] = guiCreateLabel(10, 24, 100, 52, "Player functions", false, vipPanel.window[1]) guiSetFont(vipPanel.label[1], "default-bold-small") vipPanel.label[2] = guiCreateLabel(10, 322, 102, 49, "Vehicle functions", false, vipPanel.window[1]) guiSetFont(vipPanel.label[2], "default-bold-small") vipPanel.button[1] = guiCreateButton(9, 76, 165, 47, "Godmode", false, vipPanel.window[1]) vipPanel.button[2] = guiCreateButton(9, 133, 165, 47, "Health", false, vipPanel.window[1]) vipPanel.button[3] = guiCreateButton(10, 190, 165, 47, "Random vehicle", false, vipPanel.window[1]) vipPanel.button[4] = guiCreateButton(10, 255, 345, 47, "Random dailyreward", false, vipPanel.window[1]) vipPanel.button[5] = guiCreateButton(191, 76, 165, 47, "Ghostmode", false, vipPanel.window[1]) vipPanel.button[6] = guiCreateButton(191, 133, 165, 47, "Armor", false, vipPanel.window[1]) vipPanel.button[7] = guiCreateButton(191, 190, 165, 47, "Random skin", false, vipPanel.window[1]) vipPanel.button[8] = guiCreateButton(10, 377, 165, 47, "Fix", false, vipPanel.window[1]) vipPanel.button[9] = guiCreateButton(190, 377, 165, 47, "Refill", false, vipPanel.window[1]) vipPanel.button[10] = guiCreateButton(10, 439, 165, 47, "Destroy", false, vipPanel.window[1]) vipPanel.button[11] = guiCreateButton(190, 439, 165, 47, "Random color", false, vipPanel.window[1]) vipPanel.button[12] = guiCreateButton(10, 502, 165, 47, "Water cheat", false, vipPanel.window[1]) vipPanel.button[13] = guiCreateButton(191, 502, 164, 47, "Fly cheat", false, vipPanel.window[1]) vipPanel.button[14] = guiCreateButton(10, 566, 165, 47, "Ghostcar", false, vipPanel.window[1]) vipPanel.button[15] = guiCreateButton(191, 566, 165, 47, "Spawn infernus", false, vipPanel.window[1]) guiSetVisible ( vipPanel.window[1], false ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), gui ) function show () vipPanel = guiGetVisible (vipPanel.Window[1]) if (vipPanel == true) then guiSetVisible (vipPanel.Window[1], false) showCursor (false) end if (vipPanel == false) then guiSetVisible (vipPanel.Window[1], true) showCursor (true) end end addEvent ("vipPanelOpen",true) addEventHandler ("vipPanelOpen",root,show) Link to comment
justn Posted April 18, 2014 Share Posted April 18, 2014 (edited) triggerClientEvent should be like this .. triggerClientEvent ("vipPanelOpen", thePlayer) Replace the function show, with this function show () if ( guiGetVisible(vipPanel.Window[1]) == true ) then guiSetVisible (vipPanel.Window[1], false) showCursor (false) else guiSetVisible (vipPanel.Window[1], true) showCursor (true) end end addEvent ("vipPanelOpen",true) addEventHandler ("vipPanelOpen",root,show) Edited April 18, 2014 by Guest Link to comment
Sande Posted April 18, 2014 Author Share Posted April 18, 2014 Still doesnt work, replaced all that ^^ Link to comment
justn Posted April 18, 2014 Share Posted April 18, 2014 Copy it again, had a small typo error, anyways why would you use thePlayer for the server side, when you can just use source ? Link to comment
Sande Posted April 18, 2014 Author Share Posted April 18, 2014 Server: function openVIPPanel(source) if getAccountData(getPlayerAccount(source), "vip" ) == 1 then triggerClientEvent ("vipPanelOpen", source) exports["ac-message"]:outputTopBar("VIP: Panel opened!", source,0,255,0) else exports["ac-message"]:outputTopBar("VIP: You are not vip!", source,255,0,0) end end addCommandHandler("vip", openVIPPanel ) Client function gui() vipPanel.window[1] = guiCreateWindow(498, 140, 365, 632, "Suomisu - VIP Panel", false) guiWindowSetSizable(vipPanel.window[1], false) vipPanel.label[1] = guiCreateLabel(10, 24, 100, 52, "Player functions", false, vipPanel.window[1]) guiSetFont(vipPanel.label[1], "default-bold-small") vipPanel.label[2] = guiCreateLabel(10, 322, 102, 49, "Vehicle functions", false, vipPanel.window[1]) guiSetFont(vipPanel.label[2], "default-bold-small") vipPanel.button[1] = guiCreateButton(9, 76, 165, 47, "Godmode", false, vipPanel.window[1]) vipPanel.button[2] = guiCreateButton(9, 133, 165, 47, "Health", false, vipPanel.window[1]) vipPanel.button[3] = guiCreateButton(10, 190, 165, 47, "Random vehicle", false, vipPanel.window[1]) vipPanel.button[4] = guiCreateButton(10, 255, 345, 47, "Random dailyreward", false, vipPanel.window[1]) vipPanel.button[5] = guiCreateButton(191, 76, 165, 47, "Ghostmode", false, vipPanel.window[1]) vipPanel.button[6] = guiCreateButton(191, 133, 165, 47, "Armor", false, vipPanel.window[1]) vipPanel.button[7] = guiCreateButton(191, 190, 165, 47, "Random skin", false, vipPanel.window[1]) vipPanel.button[8] = guiCreateButton(10, 377, 165, 47, "Fix", false, vipPanel.window[1]) vipPanel.button[9] = guiCreateButton(190, 377, 165, 47, "Refill", false, vipPanel.window[1]) vipPanel.button[10] = guiCreateButton(10, 439, 165, 47, "Destroy", false, vipPanel.window[1]) vipPanel.button[11] = guiCreateButton(190, 439, 165, 47, "Random color", false, vipPanel.window[1]) vipPanel.button[12] = guiCreateButton(10, 502, 165, 47, "Water cheat", false, vipPanel.window[1]) vipPanel.button[13] = guiCreateButton(191, 502, 164, 47, "Fly cheat", false, vipPanel.window[1]) vipPanel.button[14] = guiCreateButton(10, 566, 165, 47, "Ghostcar", false, vipPanel.window[1]) vipPanel.button[15] = guiCreateButton(191, 566, 165, 47, "Spawn infernus", false, vipPanel.window[1]) guiSetVisible ( vipPanel.window[1], false ) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), gui ) function show () if guiGetVisible(vipPanel.Window[1],true) then guiSetVisible (vipPanel.Window[1], false) showCursor (false) else guiSetVisible (vipPanel.Window[1], true) showCursor (true) end end addEvent ("vipPanelOpen",true) addEventHandler ("vipPanelOpen",root,show) Link to comment
justn Posted April 18, 2014 Share Posted April 18, 2014 Put this for server .. function openVIPPanel() if getAccountData(getPlayerAccount(source), "vip" ) == 1 then triggerClientEvent ("vipPanelOpen", getRootElement()) exports["ac-message"]:outputTopBar("VIP: Panel opened!", source,0,255,0) else exports["ac-message"]:outputTopBar("VIP: You are not vip!", source,255,0,0) end end addCommandHandler("vip", openVIPPanel ) and for client..the function show should be like this function show () if ( guiGetVisible(vipPanel.Window[1]) == true ) then guiSetVisible (vipPanel.Window[1], false) showCursor (false) else guiSetVisible (vipPanel.Window[1], true) showCursor (true) end end addEvent ("vipPanelOpen",true) addEventHandler ("vipPanelOpen",root,show) Link to comment
Sande Posted April 18, 2014 Author Share Posted April 18, 2014 Error: client line 2, attempt to index global vipPanel nil value. 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