Jump to content

[SOLVED] triggerClientEvent -> GUI


Gordon_G

Recommended Posts

Ok, so ... I will try to explain everything correctly.

I try to make a GUI visible by a server script and ... For some reason does that I don't know for the moment everyone see this GUI ... But I just wanna that the source of the server side can see the GUI. You understand ?

--Server 
function seegui(source) 
triggerClientEvent("achatarmesgui",root, source) 
end 
addCommandHandler("seegui", seegui) 
  

--Client 
prixarmes = { 
neufmm = {1500,22}, 
tecneuf = {4000,30}, 
deagle = {3000,24}, 
ak = {7000,32}, 
shotgun = {5500,25}, 
} 
  
local screenW, screenH = guiGetScreenSize() 
achatarmess = guiCreateWindow((screenW - 608) / 2, (screenH - 347) / 2, 608, 347, "Achat armes", false) 
guiWindowSetSizable(achatarmess, false) 
guiSetVisible ( achatarmess, false ) 
eaglei = guiCreateStaticImage(10, 171, 95, 95, "deserteagle.png", false, achatarmess) 
neufi = guiCreateStaticImage(10, 48, 95, 95, "9mm.png", false, achatarmess) 
teci = guiCreateStaticImage(142, 52, 95, 95, "tec9.png", false, achatarmess) 
shotguni = guiCreateStaticImage(261, 52, 95, 95, "shotgun.png", false, achatarmess) 
aki = guiCreateStaticImage(405, 56, 95, 95, "ak47.png", false, achatarmess) 
achatarmeslabel1 = guiCreateLabel(20, 143, 75, 17, prixarmes.neufmm[1], false, achatarmess) 
achatarmeslabel2 = guiCreateLabel(152, 143, 75, 17, prixarmes.tecneuf[1], false, achatarmess) 
achatarmeslabel3 = guiCreateLabel(20, 276, 75, 17, prixarmes.deagle[1], false, achatarmess) 
achatarmeslabel4 = guiCreateLabel(271, 143, 75, 17, prixarmes.shotgun[1], false, achatarmess) 
achatarmeslabel5 = guiCreateLabel(419, 143, 75, 17, prixarmes.ak[1], false, achatarmess) 
buttonclose = guiCreateButton(569, 23, 29, 25, "X", false, achatarmess) 
  
addEvent("achatarmesgui", true) 
function achatarmes() 
guiSetVisible(achatarmess, true) 
showCursor(true,true) 
end 
addEventHandler("achatarmesgui", root,achatarmes) 
  

So ... Could someone explain me ? Please :D

Edited by Guest
Link to comment

When you trigger the event, by triggering it to 'root' you trigger it to every element in the game. This is why everybody is seeing it and it may also cause lag.

Also when you add the event handler you also put 'root'. Basically what I am saying is by using 'root' that triggers it for everyone.

Instead of 'root', try using 'source' in serverside and getLocalPlayer() clientside. This should prevent everybody seeing your GUI and only the person who types /seegui will see it.

You're welcome.

Link to comment

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