Enter/exit systems and looping through houses
#1

Hi. I've seen a lot of samp gamemodes (mostly roleplay), and in those gamemodes they nearly always use linear search for iterating through all houses on server in order to enter a house by a command or clicking ALT. When i started to make my own enter/exit system i had decided to use a special variable (which is in the player enum) for keeping the id of the house that a player is standing at, which is calculated by some simple pickup id division, and whether the player is at the exit or the entrance is calculated with mod(%). In the OnPlayerKeyStateChange function i only check whether the player is in range of the entrance/exit pickup of the house whose id is in the player's special variable. My question is why people use linear search? Isn't it going to have weak performance on a server with, say 1000 houses and the same number of players? And is my way of making enter/exit system reasonable for a roleplay server or not?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)