Jump to content

[Help] Trigger problem


Stranger

Recommended Posts

hello, i have that problem while player is downloading the trigger will work

cause the trigger in serverside, so while he downloading the trigger will work and the error

message willl shows up "trigger clientside but event is not added clientside"

and the lag also

becuase the client as we all know works when the download finish so

is there anyway to make it stop while downloading ?

Link to comment

will it didn't help me, but make it worse

i'm trying to edit the zombie mod

cause there is a trigger will work everytime that the zombie

punched or jumped

and the trigger serverside, so the client will not work

if the download doesn't finish.

so i can't make it with table

and when want to check it i have to loop through all players

to check if he is in the table to do the trigger

so that will bring all the players in the server and make a trigger with all the numbers

of the players in the server so let's say there is a 30 player the trigger will work 30 times

in everytime the zombie punched or jumped

so nah, it didn't helps.

and thank you for trying to help me.

any help please ?

Link to comment
  • Moderators

This is circa how I am solving this problem every time I am creating a resource.

client

addEventHandler("onClientResourceStart",resourceRoot, 
function () 
    triggerServerEvent("registerPlayer",localPlayer) 
end) 

server

local playerLoadedRegistery = {} 
  
addEvent("registerPlayer",true) 
addEventHandler("registerPlayer",root, 
function () 
    if isElement(source) then 
        playerLoadedRegistery[source]= true 
    end 
end) 
  
addEventHandler("onPlayerQuit",root, 
function () 
    playerLoadedRegistery[source]=nil 
end) 

function triggerClientEvent2(...) -- event,sourceElement,arg1,arg2,arg3, etc. 
    local argTable = ... 
    for player,boolean in pairs(playerLoadedRegistery) do 
        triggerClientEvent(player,unpack(argTable)) 
    end 
end 

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