SA-MP Forums Archive
Foreach include - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Foreach include (/showthread.php?tid=566479)



Foreach include - SkyLoKi - 06.03.2015

How can I replace these functions to the standard samp functions?
Without using include foreach?

Код:
Iter_Count(Test);
parametr = Iter_Random(Test2);
Iter_Remove(Test2, parametr);
Iter_Clear(Test2);
for( new i; i < MAX_PLAYERS; i++ ) Iter_Add(Test2, i);



Re: Foreach to standart - Misiur - 06.03.2015

You could, but why? Just include y_iterate


Re: Foreach to standart - bigboy81 - 06.03.2015

Код:
for( new playerid; playerid < MAX_PLAYERS;playerid++ ) Iter_Add(Test2, playerid);



Re: Foreach to standart - SkyLoKi - 06.03.2015

Quote:
Originally Posted by bigboy81
Посмотреть сообщение
Код:
for( new playerid; playerid < MAX_PLAYERS;playerid++ ) Iter_Add(Test2, playerid);
what?? Nothing really has changed

--------------

I don`t want to use this include (foreach and others from Y_Les (they seem to me difficult))
I want the normal functions of the sump.
But I found an interesting script, and then use these variables (Iter_Count Iter_Random Iter_Remove Iter_Clear Iter_Add), and I need them to change the standard, and I do not know how


Re: Foreach include - SkyLoKi - 06.03.2015

Although it seems to understand. Now I try


Re: Foreach include - ShooteR1990 - 06.03.2015

Try this
#define foreach(%0) for(new %0 = 0; %0 <= GetPlayerPoolSize(); %0++) if(!IsPlayerConnected(%0)) continue;

Example :
foreach(i)
{
// code here
}


AW: Re: Foreach include - Kaliber - 06.03.2015

Quote:
Originally Posted by ShooteR1990
Посмотреть сообщение
Try this
This will not work

You have 2 Options...you can include it..or you post more code..so that we can have a better overview


Re: Foreach include - SkyLoKi - 06.03.2015

All. Topic can be closed ... I realized that script without include will not work correctly


Re: Foreach include - SkyLoKi - 06.03.2015

Quote:
Originally Posted by ******
Посмотреть сообщение
I think the real question is: why? Foreach builds on the standard SA:MP functions, so all you are doing is asking how to recreate something that already exists in the same way as the thing that already exists. Which means a) you end up with the same thing, but b) you have to do a lot more work to get there.
In short yes) Looked code you include , now I`ll use it) Well, at the same time redoing other options .. did not think that it would be) Thank you for include