Cronoss Posted February 7, 2022 Share Posted February 7, 2022 I was trying to learn how to make the player's head follow the cursor (and the others players can see it) and I found the "triggerLatentClientEvent " in the wiki. All it's solved but I want to ask, what's the recommended number for bandwidth? Because the number that I put it's too slow, the cursor moves and the player's head follow it seconds later, but I'm not sure to increase the number, is it gonna be laggy for other players or something like that if I increase the bandwidth? triggerLatentClientEvent("mirarjugador", 5000, false, client, x,y,z) Link to comment
Moderators IIYAMA Posted February 7, 2022 Moderators Share Posted February 7, 2022 9 hours ago, Cronoss said: , is it gonna be laggy for other players or something like that if I increase the bandwidth? Wiki: except the transmission rate of the data contained in the arguments can be limited and other network traffic is not blocked while the data is being transferred. It does 2 things: - It can be limited - It does not block while transferring. If you increase the bandwidth to max 100 MB: 100*1024*1024 You basically undo the first thing. That is fine if you only send a little bit of data. What might lag for some players is the head movement. Which is caused by the non-block transfer thing. - If the player his download is not fast enough, there will be a delay. But there will be no/little lag created for other things, like remote-player movement. (Remote-players = other player elements than yourself in your game) - And if the player download is not fast enough and can't keep up. It will stack all those latent events in a queue, which only gets longer. If you are going to use this function, then I recommend to use getLatentEventStatus for each player to check if the player receives the data. If yes, then send the next update. 1 Link to comment
Cronoss Posted February 7, 2022 Author Share Posted February 7, 2022 Quote I recommend to use getLatentEventStatus for each player Do you mean using that in Client-side or something else? also, how I could check if is it work? debug-script doesn't send me anything but I'm not sure if this works Link to comment
Moderators IIYAMA Posted February 7, 2022 Moderators Share Posted February 7, 2022 53 minutes ago, Cronoss said: Do you mean using that in Client-side or something else? At the side the triggerClient/ServerEvent is locaties. 53 minutes ago, Cronoss said: debug-script doesn't send me anything but I'm not sure if this works The debug console only shows you errors, warnings by default. If you want more information than that. You will have to add debug lines. (iprint) Those lines will show up as soon as the code execute them. If they are not shown up while they should, that means that there is a mistake before them. If you keep moving them forwards/backwards, you will eventually find the location of the problem. Between showing up and not showing up, is the problem. iprint("A") if false then --[[ <<<< B not is showing up? And A is? Then here is the problem ]] iprint("B") end They are also handy to debug variables, which are often containing incorrect values when there is a bug. Link to comment
Cronoss Posted February 7, 2022 Author Share Posted February 7, 2022 All I got it's a "Expected number, got non-convertible string" when I added getLatentEventStatus, I don't know if I really could understand how to use it, specially because the language (english not my main language) add difficulty in this to me, because of some terms... but it still necessary add that option If I DON'T increase the bandwidth to max? or there is a chance that it will lag anyway Link to comment
Cronoss Posted February 7, 2022 Author Share Posted February 7, 2022 This is server-side function... I don't know really how to make it work function hms(x,y,z) ----------------- I don't know how or where to add the "getLatentEventStatus", in the wiki the only example it's about "starts a latent event and outputs the status of the transfer to the client console" triggerLatentClientEvent("mirarA", 104857600, false, client, x,y,z) end addEvent('mirarPS', true) addEventHandler('mirarPS', root, hmc) Link to comment
Moderators IIYAMA Posted February 7, 2022 Moderators Share Posted February 7, 2022 50 minutes ago, Cronoss said: I don't know really how to make it work Like the code below. I have put the bandwidth limit very low so that you can see the transfer status in action. Just make sure you are the only player in the server. local playerLatentHandles = {} local bandwidthLimit = 100 -- 104857600 function hms(x,y,z) triggerLatentClientEvent("mirarA", bandwidthLimit, false, client, x,y,z) -- Get the current handle local handles = getLatentEventHandles(client) local currentHandle = handles[#handles] playerLatentHandles[client] = currentHandle end addEvent('mirarPS', true) addEventHandler('mirarPS', root, hmc) -- Testing: setTimer(function () local player = getRandomPlayer() local currentHandle = playerLatentHandles[player] if currentHandle then local status = getLatentEventStatus( player, currentHandle) iprint(player, status) end end, 500, 0) @Cronoss I did fixed a bug just a sec ago. Link to comment
Cronoss Posted February 7, 2022 Author Share Posted February 7, 2022 This is what it says Link to comment
Moderators IIYAMA Posted February 7, 2022 Moderators Share Posted February 7, 2022 14 minutes ago, Cronoss said: This is what it says client is only available when you call hms with a 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