SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 06/03/2015, 02:22 PM   #1
SkyLoKi
Big Clucker
 
SkyLoKi's Avatar
 
Join Date: Aug 2013
Location: Russia
Posts: 61
Reputation: 3
Default Foreach include

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

Code:
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);
SkyLoKi is offline   Reply With Quote
Old 06/03/2015, 02:23 PM   #2
Misiur
High-roller
 
Misiur's Avatar
 
Join Date: Jul 2009
Location: Poland
Posts: 2,526
Reputation: 554
Default Re: Foreach to standart

You could, but why? Just include y_iterate
Misiur is offline   Reply With Quote
Old 06/03/2015, 02:23 PM   #3
bigboy81
Huge Clucker
 
bigboy81's Avatar
 
Join Date: Dec 2014
Location: United Kingdom
Posts: 315
Reputation: 3
Default Re: Foreach to standart

Code:
for( new playerid; playerid < MAX_PLAYERS;playerid++ ) Iter_Add(Test2, playerid);
bigboy81 is offline   Reply With Quote
Old 06/03/2015, 02:31 PM   #4
SkyLoKi
Big Clucker
 
SkyLoKi's Avatar
 
Join Date: Aug 2013
Location: Russia
Posts: 61
Reputation: 3
Default Re: Foreach to standart

Quote:
Originally Posted by bigboy81 View Post
Code:
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
SkyLoKi is offline   Reply With Quote
Old 06/03/2015, 02:44 PM   #5
SkyLoKi
Big Clucker
 
SkyLoKi's Avatar
 
Join Date: Aug 2013
Location: Russia
Posts: 61
Reputation: 3
Default Re: Foreach include

Although it seems to understand. Now I try
SkyLoKi is offline   Reply With Quote
Old 06/03/2015, 02:47 PM   #6
ShooteR1990
Little Clucker
 
ShooteR1990's Avatar
 
Join Date: Aug 2012
Location: Russia
Posts: 45
Reputation: 5
Default Re: Foreach include

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

Example :
foreach(i)
{
// code here
}
__________________
Best wishes, ShooteR1990
Play in SA:MP since 2009 / Pawn scripting since 2010
Do not pm me.
ShooteR1990 is offline   Reply With Quote
Old 06/03/2015, 02:54 PM   #7
Kaliber
High-roller
 
Kaliber's Avatar
 
Join Date: Jun 2012
Location: Localhost
Posts: 1,067
Reputation: 151
Default AW: Re: Foreach include

Quote:
Originally Posted by ShooteR1990 View Post
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
__________________
Kaliber is offline   Reply With Quote
Old 06/03/2015, 03:39 PM   #8
SkyLoKi
Big Clucker
 
SkyLoKi's Avatar
 
Join Date: Aug 2013
Location: Russia
Posts: 61
Reputation: 3
Default Re: Foreach include

All. Topic can be closed ... I realized that script without include will not work correctly
SkyLoKi is offline   Reply With Quote
Old 06/03/2015, 03:48 PM   #9
SkyLoKi
Big Clucker
 
SkyLoKi's Avatar
 
Join Date: Aug 2013
Location: Russia
Posts: 61
Reputation: 3
Default Re: Foreach include

Quote:
Originally Posted by ****** View Post
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
SkyLoKi 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
Old foreach.ini FlawPaw Server Support 0 05/11/2013 03:32 PM
Standart Include 4 Error Extazik Scripting Help 1 25/03/2013 09:28 AM
ForEach or Where? milanosie Scripting Help 3 30/01/2012 11:48 AM
How to remove standart textdraws [WSF]ThA_Devil Help Archive 3 03/11/2010 08:00 PM


All times are GMT. The time now is 05:50 PM.


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