SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 29/03/2013, 11:52 PM   #1
Huge Clucker
Join Date: Oct 2008
Posts: 410
Reputation: 20
Default Local Messages (Using y_iterate and Incognito's Streamer Plugin)

In most, or even all game modes, the most common algorithm to send local messages is to loop through all
connected players, get their distance from the player that sent the message and send the message if the distance isn't too big.

Using Incognito's Streamer Plugin and Y_Less' y_iterate (AKA foreach) I came up with another way of doing it.
However I'm not sure if its more efficient for the long term.

For every player, there's a 3d sphere zone created and attached to the player.
Multi-dimensional iterator to store the players in each area.

When players enter or leave an area they get added to the iterator of that area or removed from it respectively.
And finally whenever there's a need to send a local message it will only loop through the players that are
in the area of the player that sent the message.

This way does take much more memory, and I suspect that it might be less efficient when
there are many people online (players entering and leaving areas all the time...)

The main use of those local messages are for roleplay servers that have different types of chat ranges, that means more zones and more memory.

I want to hear your opinion of the algorithm I suggested here, what do you think?
Maxips2 is offline   Reply With Quote

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Include] Checkpoint / Area sub-streamer for incognito's streamer plugin Pottus Includes 11 21/03/2014 07:31 PM
Local Messages (Using y_iterate and Incognito's Streamer Plugin) Maxips2 Scripting Help 0 29/03/2013 01:18 PM
0.3 (C) To (E) Incognito Streamer Plugin I3Psychedelic Scripting Help 7 31/12/2012 04:46 AM
Incognito's streamer plugin sim_sima Help Archive 7 27/05/2011 11:27 AM
incognito streamer plugin... Whizion Help Archive 4 30/08/2010 02:05 PM

All times are GMT. The time now is 03:32 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.