SA-MP Forums Archive
Old foreach.inc files are no longer compatible with YSI. - 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: Old foreach.inc files are no longer compatible with YSI. (/showthread.php?tid=404545)



Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Hi guys i get this error:

I try to update still it give me the same error but i try to change the #include <foreach> to #include <YSI\y_iterate>

But now when i compile the pawno [F5] it crash and still it make the .amx but i get error down below i show did

Код:
"Old foreach.inc files are no longer compatible with YSI."
Код:
SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[17:10:36] 
[17:10:36] Server Plugins
[17:10:36] --------------
[17:10:36]  Loading plugin: audio.dll
[17:10:36] *** Audio Plugin v0.4 by Incognito loaded ***
[17:10:36]   Loaded.
[17:10:36]  Loading plugin: sscanf.dll
[17:10:36] 

[17:10:36]  ===============================

[17:10:36]       sscanf plugin loaded.     

[17:10:36]    © 2009 Alex "******" Cole

[17:10:36]  ===============================

[17:10:36]   Loaded.
[17:10:36]  Loading plugin: streamer.dll
[17:10:36] 

*** Streamer Plugin v2.5.2 by Incognito loaded ***

[17:10:36]   Loaded.
[17:10:36]  Loaded 3 plugins.

[17:10:36] 
[17:10:36] Filterscripts
[17:10:36] ---------------
[17:10:36]   Loading filterscript 'carwash.amx'...
[17:10:36] 
-----------------------------------------------
[17:10:36]  
[17:10:36] ---=== Car Wash Filterscript ===---
[17:10:36]  
[17:10:36] -------------- Copyright -- 2011 --------------

[17:10:36]   Loading filterscript 'buttons.amx'...
[17:10:36]   Loading filterscript 'ls_elevator.amx'...
[17:10:36]   Loaded 3 filterscripts.

[17:10:36] Script[gamemodes/CLRP.amx]: Run time error 17: "Invalid/unsupported P-code file format"
[17:10:36] Failed to load 'gamemodes/CLRP.amx' script.
[17:10:36] Number of vehicle models: 0

----------
Loaded log file: "server_log.txt".
----------

SA-MP Dedicated Server
----------------------
v0.3e-R2, ©2005-2012 SA-MP Team

[17:34:10] 
[17:34:10] Server Plugins
[17:34:10] --------------
[17:34:10]  Loading plugin: audio.dll
[17:34:10] *** Audio Plugin v0.4 by Incognito loaded ***
[17:34:10]   Loaded.
[17:34:10]  Loading plugin: sscanf.dll
[17:34:10] 

[17:34:10]  ===============================

[17:34:10]       sscanf plugin loaded.     

[17:34:10]    © 2009 Alex "******" Cole

[17:34:10]  ===============================

[17:34:10]   Loaded.
[17:34:10]  Loading plugin: streamer.dll
[17:34:10] 

*** Streamer Plugin v2.5.2 by Incognito loaded ***

[17:34:10]   Loaded.
[17:34:10]  Loaded 3 plugins.

[17:34:10] 
[17:34:10] Filterscripts
[17:34:10] ---------------
[17:34:10]   Loading filterscript 'carwash.amx'...
[17:34:10] 
-----------------------------------------------
[17:34:10]  
[17:34:10] ---=== Car Wash Filterscript ===---
[17:34:10]  
[17:34:10] -------------- Copyright -- 2011 --------------

[17:34:10]   Loading filterscript 'buttons.amx'...
[17:34:10]   Loading filterscript 'ls_elevator.amx'...
[17:34:10]   Loaded 3 filterscripts.

[17:34:10] Script[gamemodes/CLRP.amx]: Run time error 17: "Invalid/unsupported P-code file format"
[17:34:10] Failed to load 'gamemodes/CLRP.amx' script.
[17:34:10] Number of vehicle models: 0



Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Quote:
Originally Posted by ******
Посмотреть сообщение
Delete foreach.inc and use y_iterate. I thought I had fixed this actually.
Yeah if you remember we try did but when i press F5 it crash the pawno still it makes the .amx and when i start the server i get

Код:
[17:34:10] Script[gamemodes/TMTURK.amx]: Run time error 17: "Invalid/unsupported P-code file format"
[17:34:10] Failed to load 'gamemodes/TMTURK.amx' script.
[17:34:10] Number of vehicle models: 0



Re: Old foreach.inc files are no longer compatible with YSI. - InfiniTy. - 03.01.2013

I think you have the old way of looping through players with foreach(Player,i)
If is like that then you need to change it all in
foreach(New i : Player)


Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Quote:
Originally Posted by Adytza.
Посмотреть сообщение
I think you have the old way of looping through players with foreach(Player,i)
If is like that then you need to change it all in
foreach(New i : Player)
So how do i replace it ?

To which one to what ?


Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

I got something like this:

Код:
public RentTimer()
{
	foreach(Player,i)
	{
		new rentcar = GetPlayerVehicleID(i);
		if(gBike[i] == 0 && IsARental(rentcar) && gBikeRenting[i] == 1)
		{
			RemovePlayerFromVehicle(i);
			new Float:X, Float:Y, Float:Z;
			GetPlayerPos(i, X, Y, Z);
			SetPlayerPos(i, X, Y, Z+2);
			SetVehicleToRespawn(rentcar);
			SendClientMessageEx(i,COLOR_GREY,"Your rental is up, you may get a new bike at the bike rental.");
			KillTimer(GetPVarInt(i, "RentTime"));
			gBikeRenting[i] = 0;
			return 1;
  		}
  		if(gBike[i] == 0 && gBikeRenting[i] == 1)
  		{
			SendClientMessageEx(i,COLOR_GREY,"Your rental has timed out, please return to the bike store to rent a new one.");
			KillTimer(GetPVarInt(i, "RentTime"));
			gBikeRenting[i] = 0;
			return 1;
  		}
  		if(gBike[i] >=1){gBike[i]--; return 1;}
    }
    return 1;
}



Re: Old foreach.inc files are no longer compatible with YSI. - Konstantinos - 03.01.2013

Quote:
Originally Posted by aslan890
Посмотреть сообщение
So how do i replace it ?

To which one to what ?
I've changed the syntax of your script to the new few days ago. But if you need to fix it by yourself, just paste the gamemode into a notepad and use CTRL + F and inside the box "foreach". Any part of code which is like this
pawn Код:
foreach(Player, i)
should be
pawn Код:
foreach(new i : Player)
i is the variable, it may be "p" or "playerid", so it should be
pawn Код:
foreach(new p : Player)
or
pawn Код:
foreach(new playerid : Player)
instead.


Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I've changed the syntax of your script to the new few days ago. But if you need to fix it by yourself, just paste the gamemode into a notepad and use CTRL + F and inside the box "foreach". Any part of code which is like this
pawn Код:
foreach(Player, i)
should be
pawn Код:
foreach(new i : Player)
i is the variable, it may be "p" or "playerid", so it should be
pawn Код:
foreach(new p : Player)
or
pawn Код:
foreach(new playerid : Player)
instead.
I didn't understand the last 2 what do i have to do with them?


Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Any answer bro i need to open my server tomorrow! So please help me team if you are free now?


Re: Old foreach.inc files are no longer compatible with YSI. - Konstantinos - 03.01.2013

i will try to expain it very simple. In your script (old version) the syntax is:
pawn Код:
foreach(Player, variable_name_here)
and it becomes (new version)
pawn Код:
foreach(new variable_name_here: Player)
You do replace the variable_name_here with a name of the variable, it might be i, p, playerid or wharever.
Let's say you have this.
pawn Код:
foreach(Player, LOL)
With the new syntax, it becomes
pawn Код:
foreach(new LOL: Player)
I hope that I explained very good and the point is to understand it.

PS: Did you find the missing brace?


Re: Old foreach.inc files are no longer compatible with YSI. - aslan890 - 03.01.2013

Sorry the brain is burned LoL its really hard for me.

I got this one -

Код:
foreach(Player, p)
Do i have to change this to what?