Jump to content

Mature

Members
  • Posts

    52
  • Joined

  • Last visited

Everything posted by Mature

  1. Hello community, my first post here! : D, I'm creating a server that involves a lot of players and whether or not I want to work with a lot of information, I've been thinking and how my scripts will use a lot of player tables where they pull everyone from the server if instead of putting the for in server ', the player must process and select the elements and send them to the server, to the server role instead of checking and finding the elements he only needs to send information to the players. Can this improve machine and server performance? Server function localC (thePlayer, _, message) if message then triggerClientEvent(thePlayer, "processClient", root, message) end end addCommandHandler("local", localC) Client addEvent("processClient", true) addEventHandler("processClient", root, function (message) x,y,z = getElementPosition(getLocalPlayer()) for theKey,players in ipairs(getElementsByType ( "player" )) do xP,yP,zP = getElementPosition(players) if getDistanceBetweenPoints3D (x , y, z, xP, yP, zP) < 20 then triggerServerEvent("sendMessage", localPlayer, localPlayer, players, message) end end end) Server addEvent("sendMessage", true) addEventHandler("sendMessage", root, function (thePlayer, player, message) outputChatBox(getPlayerName(thePlayer).." Send: "..message, player, 255,255,255, true) end)
×
×
  • Create New...