Foreach Error
#1

SOLVED! Thanks!
Reply
#2

pawn Код:
stock CounterRadio(const string[])
{
    foreach(Player, i)
    {
        if(GetPlayerState(i) != PLAYER_STATE_NONE)
        {
            if(GetPlayerClass[i] == TEAM_COUNTER)
            {
                SendClientMessage(i, BLUE, string);
            }
        }
    }
    return 1;
}
Add the following line to the top of your script:
pawn Код:
#include <foreach>
This requires you to download and place the foreach include file into your pawno/includes/ folder.
The foreach thread can be found here if you do not already have the include file: https://sampforum.blast.hk/showthread.php?tid=92679

EDIT: StuartD, you were literally 1 or 2 seconds behind me, I couldn't believe that :P
Reply
#3

Do you have Foreach included at the top of your script?

EDIT: Too Slow
Reply
#4

Do you have foreach include and it is defined before a_samp include? Also, the code must be like this:

pawn Код:
stock CounterRadio(const string[])
{
    foreach(Player, i)
    {
        if(GetPlayerState(i) != PLAYER_STATE_NONE)
        {
            if(GetPlayerClass[i] == TEAM_COUNTER)
            {
                SendClientMessage(i, BLUE, string);
            }
        }
    }
    return true;
}
EDIT: I'm late too, only 60000 milliseconds.
Reply
#5

Yes i have include it and Thanks SOLVED!
Reply
#6

Quote:
Originally Posted by iZN
Посмотреть сообщение
Do you have foreach include and it is defined before a_samp include? Also, the code must be like this:

pawn Код:
stock CounterRadio(const string[])
{
    foreach(Player, i)
    {
        if(GetPlayerState(i) != PLAYER_STATE_NONE)
        {
            if(GetPlayerClass[i] == TEAM_COUNTER)
            {
                SendClientMessage(i, BLUE, string);
            }
        }
    }
    return true;
}
EDIT: I'm late too, only 60000 milliseconds.
return true; and return 1; are all the same e_e
Reply
#7

And... why did you post that?
Reply
#8

Quote:
Originally Posted by Sublime
Посмотреть сообщение
return true; and return 1; are all the same e_e
I know, that's my habit you can say. Whenever I see return 1 or 0 I change it to true or false.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)