Get Random Helper Problem
#1

Hi all, how could I do a script by which to select a completely random ID helper.
I tried to make this way but fail and I have no idea what's wrong if someone can help me?
PHP код:
foreach(Playeri)
{
   if(
PlayerInfo[i][pHelper] >= 1)
   {
        new 
randomhelp random(i);
        
SCM(randomhelp, -1"Test");
   }

How should I do? - Sorry for my bad english, i use ****** translate
Reply
#2

So I think you have your PlayerInfo and in there you have the "pHelper" and you want to choose a random player where pHelper is greater than 0. So I do not get what you are doing there, i guess this is what you want:

PHP код:
new random(MAX_PLAYERS);
while( (!
IsPlayerConnected(i)) || PlayerInfo[i][pHelper] < 1){
    
random(MAX_PLAYERS);
}
new 
randomhelp i
Reply
#3

Quote:
Originally Posted by SoLetsGO
Посмотреть сообщение
So I think you have your PlayerInfo and in there you have the "pHelper" and you want to choose a random player where pHelper is greater than 0. So I do not get what you are doing there, i guess this is what you want:

PHP код:
new random(MAX_PLAYERS);
while( (!
IsPlayerConnected(i)) || PlayerInfo[i][pHelper] < 1){
    
random(MAX_PLAYERS);
}
new 
randomhelp i
thank you ! it's work
Reply
#4

Quote:
Originally Posted by SoLetsGO
Посмотреть сообщение
So I think you have your PlayerInfo and in there you have the "pHelper" and you want to choose a random player where pHelper is greater than 0. So I do not get what you are doing there, i guess this is what you want:

PHP код:
new random(MAX_PLAYERS);
while( (!
IsPlayerConnected(i)) || PlayerInfo[i][pHelper] < 1){
    
random(MAX_PLAYERS);
}
new 
randomhelp i
If there's no helper online, then you just entered an infinite loop.

Create a foreach iterator for helpers and use Iter_Random()
Reply
#5

Quote:
Originally Posted by Spmn
Посмотреть сообщение
If there's no helper online, then you just entered an infinite loop.

Create a foreach iterator for helpers and use Iter_Random()
I already created a function by which to check if any helper on duty
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)