Ivo1313 Posted January 19, 2020 Share Posted January 19, 2020 Hello guys, i'm doing a gunshop script but i dont know how to use triggerClientEvent properly for this situations, i have the client and server program here but they're not working for now: Server marcador = createMarker(296.60345458984,-38.278450012207,1000.515625, "cylinder", 1.1, 0,100,0) setElementInterior(marcador, 1) function showPanel(thePlayer) triggerClientEvent ("Start", thePlayer) end addEventHandler("onMarkerHit", marcador, showPanel) Client function painel (hitPlayer) if ( hitPlayer == localPlayer ) then outputChatBox("aloboizaumm") if painel == false then showCursor (true) addEventHandler ("onClientRender", root,abrir) painel = true end end addEvent("Start", true) addEventHandler("Start", root, painel) Link to comment
nikitafloy Posted January 19, 2020 Share Posted January 19, 2020 (edited) triggerClientEvent (thePlayer, "Start", thePlayer) function painel () outputChatBox("aloboizaumm") if painel == false then showCursor (true) addEventHandler ("onClientRender", root,abrir) painel = true end end addEvent("Start", true) addEventHandler("Start", localPlayer, painel) triggerClientEvent Edited January 19, 2020 by nikitafloy Link to comment
Ivo1313 Posted January 19, 2020 Author Share Posted January 19, 2020 Hello! I've been reading this article for hours and i dont get any green lights for my program, your sketch aren't working here too sadly Link to comment
JeViCo Posted January 19, 2020 Share Posted January 19, 2020 Imagine that server has ~100 players on it. You're telling the server to open panel on client-side. The server doesn't know which player you're talking about and it opens it on every single client. This is what happens when you use triggerClientEvent("Start", ThePlayer) To fix it tell the server to use specific client(player) by adding player variable as the first argument: triggerClientEvent(ThePlayer, "Start", ThePlayer) Same thing was shown above BTW this is the single difference between triggerClientEvent and triggerServerEvent 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