SA-MP Forums Archive
(i) Problem Help - 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: (i) Problem Help (/showthread.php?tid=514079)



(i) Problem Help - samp_boy - 19.05.2014

Hello Guys i can't find where is the problem help me



Код:
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : error 017: undefined symbol "i"
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : warning 215: expression has no effect
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : error 017: undefined symbol "i"
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : warning 215: expression has no effect
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : error 017: undefined symbol "i"
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Line 365:


Код:
function StartMap()
{
    new str[128];
    foreach(Player,i)
	{
        SetCameraBehindPlayer(i);
	    ClearAnimations(i);
		HumanSetup(i);
		SpawnPlayer(i);
		SetPlayerDrunkLevel(i,0);
		DisablePlayerCheckpoint(i);
		TextDrawHideForPlayer(i, ServerIntroOne[i]);
		TextDrawHideForPlayer(i, ServerIntroTwo[i]);
		DestroyPickup(meatDrops[i]);
		DestroyPickup(ammoDrops[i]);
		TogglePlayerControllable(i,1);
	}
i will + Rep


Re: (i) Problem Help - JFF - 19.05.2014

pawn Код:
function StartMap()
{
    new str[128];
    for(new i=0;i <MAX_PLAYERS;i++)
    {
        SetCameraBehindPlayer(i);
        ClearAnimations(i);
        HumanSetup(i);
        SpawnPlayer(i);
        SetPlayerDrunkLevel(i,0);
        DisablePlayerCheckpoint(i);
        TextDrawHideForPlayer(i, ServerIntroOne[i]);
        TextDrawHideForPlayer(i, ServerIntroTwo[i]);
        DestroyPickup(meatDrops[i]);
        DestroyPickup(ammoDrops[i]);
        TogglePlayerControllable(i,1);
    }
}



Re : (i) Problem Help - samp_boy - 19.05.2014

doesn't work


Re: (i) Problem Help - Madd92 - 19.05.2014

Well you have to declare the variable i if you want to use it.
Also, I think you should use foreach like this:
pawn Код:
foreach (i : Player)
// or even better
foreach (new i : Player)



Re: Re : (i) Problem Help - JFF - 19.05.2014

Quote:
Originally Posted by samp_boy
Посмотреть сообщение
doesn't work
What errors u get?


Re : Re: (i) Problem Help - samp_boy - 19.05.2014

Quote:
Originally Posted by Madd92
Посмотреть сообщение
Well you have to declare the variable i if you want to use it.
Also, I think you should use foreach like this:
pawn Код:
foreach (i : Player)
// or even better
foreach (new i : Player)
still doesn't work :/


Re : Re: Re : (i) Problem Help - samp_boy - 19.05.2014

Quote:
Originally Posted by JFF
Посмотреть сообщение
What errors u get?

same errors


Re: Re : Re: Re : (i) Problem Help - Madd92 - 19.05.2014

Quote:
Originally Posted by samp_boy
Посмотреть сообщение
same errors
That is not possible really, since you have declared i now.
So this error shouldn't occur anymore:
pawn Код:
C:\Documents and Settings\magnifique2012\Bureau\zm.pwn(365) : error 017: undefined symbol "i"
pawn Код:
function StartMap()
{
    new str[128];
    foreach(new i : Player)
    {
        SetCameraBehindPlayer(i);
        ClearAnimations(i);
        HumanSetup(i);
        SpawnPlayer(i);
        SetPlayerDrunkLevel(i,0);
        DisablePlayerCheckpoint(i);
        TextDrawHideForPlayer(i, ServerIntroOne[i]);
        TextDrawHideForPlayer(i, ServerIntroTwo[i]);
        DestroyPickup(meatDrops[i]);
        DestroyPickup(ammoDrops[i]);
        TogglePlayerControllable(i,1);
    }
}
Should work if you are using the right include.


Re: (i) Problem Help - Rittik - 19.05.2014

Код:
#include <foreach>
At the top of your gamemode.


Re : (i) Problem Help - samp_boy - 19.05.2014

Madd92: lemme pm u the full code
Rittik: lol i have already did