Posts: 1,767
Threads: 124
Joined: Mar 2010
pawn Code:
stock ZwrocMAXIDWyscigu()
{
foreach2(i, MAX_RACES)
{
if(Race[i][rStatus])return i;
}
return -1;
}
I need to count races to use it in random. It's returning me 0 in debug. Why? rStatus is setting to = 1.
Posts: 2,929
Threads: 160
Joined: Feb 2009
Reputation:
0
If rStatus is set to '1', than it's obvious that this will return 0 - the first iterator is probably 0.
Posts: 1,767
Threads: 124
Joined: Mar 2010
It's look like that:
In OnGameModeInit.. soo.. it's need to be = 0 as you told, yes? if it is.. it will return -1.
Posts: 1,767
Threads: 124
Joined: Mar 2010
Posts: 1,767
Threads: 124
Joined: Mar 2010
2nd page.. guys i need it for real..
Posts: 2,929
Threads: 160
Joined: Feb 2009
Reputation:
0
I don't understand your problem. Please be more clear and post some more code.
Posts: 48
Threads: 5
Joined: Aug 2011
Reputation:
0
i is probably 0 ?
The first time it executes, will return i , so = 0
Posts: 1,767
Threads: 124
Joined: Mar 2010
It's getting race id and random from all and automaticly start. MAX_RACES is 2.. but it's dynamic system i can add more if i wan't.. [rStatus] = 1; in OnGameModeInit and it should return race id. But it's returning me 0.. and won't random from races. Understand? : d
Posts: 1,767
Threads: 124
Joined: Mar 2010
pawn Code:
stock StartRandomRace()
{
if(!SerwerInfo[rRaceStarted])
{
SerwerInfo[rAktualny_Wyscig] = random(ReturnMaxIDRace());
SerwerInfo[rPlayersCanJoinRace] = true;
SerwerInfo[rRaceStarted] = true;
SerwerInfo[rTimeEntries] = 5;
SerwerInfo[sTimers][1] = SetTimer("StartRaces", SECONDS(1), true);
printf("Wyścig przypisany do ID: %d", SerwerInfo[rAktualny_Wyscig]);
}
return true;
}
pawn Code:
stock ReturnMaxIDRace()
{
foreach2(i, MAX_RACES)
{
if(Race[i][rStatus])return i;
}
return true;
}
...
Posts: 1,767
Threads: 124
Joined: Mar 2010
Hah.. thank you very much.. finally works
P.S
Can i ask you something? but on PM.