SA-MP Forums Archive
for(new>) not working - 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: for(new>) not working (/showthread.php?tid=660398)



for(new>) not working - playstores - 02.11.2018

Quote:

for(new id = 0; id < MAX_PLAYERS; id++)
{
if(PlayerInfo[id][GMember] == group && PlayerInfo[id][pLoggedIn]==true)
{
GCount[playerid]+=1;
}
}
MsgEx(playerid,-1,"There are currently %d Group Members Online",GCount[playerid]);
GCount[playerid] = 0;
return 1;


Well, I get always "2"


Re: for(new>) not working - UFF - 02.11.2018

pawn Code:
for(new id = 0; id < MAX_PLAYERS; id++)
{
  if(PlayerInfo[id][GMember] == group && PlayerInfo[id][pLoggedIn]==true)
 {
    GCount[id] ++;
  }
}
MsgEx(playerid,-1,"There are currently %d Group Members Online",GCount[playerid]);
GCount[playerid] = 0;
return 1;
try this


Re: for(new>) not working - playstores - 02.11.2018

still the same & that is not making sense in this case :c


Re: for(new>) not working - ReD_HunTeR - 02.11.2018

is that a cmd ? try using normal variable

pawn Code:
new GCount = 0;
for(new id = 0, j = GetPlayerPoolSize(); id <= j; id++)
{
    if(PlayerInfo[id][pLoggedIn] && PlayerInfo[id][GMember] == group)
    {
        GCount++; //Using id here was a mistake
    }
}
MsgEx(playerid, -1, "There are currently %d Group Members Online", GCount);
return 1;
this should absolutely work fine, if it doesn't the problem occurs from somewhere else, maybe at "group"


Re: for(new>) not working - playstores - 02.11.2018

works fine with this code +rep