SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 29/03/2013, 11:52 PM   #1
Maxips2
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
Old 30/03/2013, 12:05 AM   #2
SuperViper
High-roller
 
SuperViper's Avatar
 
Join Date: Sep 2011
Posts: 1,196
Reputation: 315
Default Re: Local Messages (Using y_iterate and Incognito's Streamer Plugin)

Or you could use a custom GetDistanceBetweenPlayers function which accepts position parameters so that it doesn't have to retrieve the same player's position 500 times.
__________________
Release NameUse
FairPlayKeep the cheaters out of your server
Object Model ArrayArray of every single object model in the game
RCON PanelControl any server as you like with RCON controls
SlopeClimb up a steep hill against other players with cars falling down

I do not play on any SAMP server. Anyone with the name Ricky Phelps in-game is an imposter.
SuperViper is offline   Reply With Quote
Old 30/03/2013, 12:10 AM   #3
Maxips2
Huge Clucker
 
Join Date: Oct 2008
Posts: 410
Reputation: 20
Default Re: Local Messages (Using y_iterate and Incognito's Streamer Plugin)

Quote:
Originally Posted by SuperViper View Post
Or you could use a custom GetDistanceBetweenPlayers function which accepts position parameters so that it doesn't have to retrieve the same player's position 500 times.
Hmm I actually haven't thought about that, I haven't seen the source code of his streamer plugin (****** won't let me).

I would still like to hear more opinions, perhaps from someone who saw his source code, or knows how it works.
Maxips2 is offline   Reply With Quote
Reply

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:51 PM.


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