[Include] FoxForeach Fast and simple player loop
#1

This include contain function for fast loop for player.

PHP код:
/****************************************************************************************************
 *                                                                                                  *
 *                                           FoX Foreach                                            *
 *                                                                                                  *
 * Copyright © 2016 Abyss Morgan. All rights reserved.                                              *
 *                                                                                                  *
 * Download: https://github.com/AbyssMorgan/SA-MP/tre...nclude/SAM                           *
 *                                                                                                  *
 * Plugins: None                                                                                    *
 * Modules: None                                                                                    *
 *                                                                                                  *
 * File Version: 1.2.1                                                                              *
 * SA:MP Version: 0.3.7                                                                             *
 *                                                                                                  *
 * Functions:                                                                                       *
 * FoxForeach(variable,tag); //Tags: Player, Bot, Character                                         *
 *                                                                                                  *
 * Player Functions:                                                                                *
 * CountFoxPlayer();                                                                                *
 * FoxForeachRandomPlayer();                                                                        *
 * bool:IsPlayerInFoxPool(playerid);                                                                *
 *                                                                                                  *
 * Bot Functions:                                                                                   *
 * CountFoxBot();                                                                                   *
 * FoxForeachRandomBot();                                                                           *
 * bool:IsBotInFoxPool(playerid);                                                                   *
 *                                                                                                  *
 * Character Functions:                                                                             *
 * CountFoxCharacter();                                                                             *
 * FoxForeachRandomCharacter();                                                                     *
 * bool:IsCharacterInFoxPool(playerid);                                                             *
 *                                                                                                  *
 * Extended functions:                                                                              *
 * foX(variable,beginning,end);                                                                     *
 * foreach(variable);                                                                               *
 *                                                                                                  *
 * Auto functions:                                                                                  *
 * FoxForeachInit();                                                                                *
 * bool:FoxAddPlayer(playerid);                                                                     *
 * bool:FoxRemovePlayer(playerid);                                                                  *
 * bool:FoxAddBot(playerid);                                                                        *
 * bool:FoxRemoveBot(playerid);                                                                     *
 * bool:FoxAddCharacter(playerid);                                                                  *
 * bool:FoxRemoveCharacter(playerid);                                                               *
 *                                                                                                  *
 ****************************************************************************************************/ 
Differences between foreach.inc and FoxForeach.inc

foreach.inc:
PHP код:
foreach(new Player){
    
SendClientMessage(i,0xFFFFFFFF,"Hello players!");
}
foreach(new 
Bot){
    
SendClientMessage(i,0xFFFFFFFF,"Hello bot!");
}
foreach(new 
Character){
    
SendClientMessage(i,0xFFFFFFFF,"Hello all!");

FoxForeach.inc:
PHP код:
FoxForeach(i,Player){
    
SendClientMessage(i,0xFFFFFFFF,"Hello players!");
}
FoxForeach(i,Bot){
    
SendClientMessage(i,0xFFFFFFFF,"Hello bots!");
}
FoxForeach(i,Character){
    
SendClientMessage(i,0xFFFFFFFF,"Hello all!");

Speed Test for Operation:

Test #1 Foreach for 500 players, 1000 operations per player
Test #2 Foreach for 400 players, 1000 operations per player (Players id 0 - 99 left the server)

FoxForeach:
Test #1 For 500000 iteration in 489 ms
Test #2 For 400000 iteration in 393 ms

Foreach:
Test #1 For 500000 iteration in 500 ms
Test #2 Server Crash. Why ?

Speed Test Script

Download:
FoxForeach.inc

FoxForeach.inc]
Reply


Messages In This Thread
FoxForeach Fast and simple player loop - by AbyssMorgan - 03.07.2016, 05:51
Re: FoxForeach Fast and simple player loop - by Gammix - 03.07.2016, 06:27
Re: FoxForeach Fast and simple player loop - by AbyssMorgan - 03.07.2016, 06:30
Re: FoxForeach Fast and simple player loop - by SyS - 03.07.2016, 06:31
Re: FoxForeach Fast and simple player loop - by AbyssMorgan - 03.07.2016, 06:33
Re: FoxForeach Fast and simple player loop - by Yashas - 06.07.2016, 14:07
Re: FoxForeach Fast and simple player loop - by AbyssMorgan - 06.07.2016, 14:16
Re: FoxForeach Fast and simple player loop - by AbyssMorgan - 06.07.2016, 18:06

Forum Jump:


Users browsing this thread: 1 Guest(s)