How to get for() looping to return 0
#1

Basically I am having a hard time how to get for looping posted below to return 0 or 1 while it still loops through i
Код:
for(new i = 0; i < 17; i++)
{
	if(List[i][Position] < 16) 
	{
		if(List[i][Number] == -1) 
		{
			//code
			List[i][Position] ++;
		}
		else
		{
			//code
			List[i][Position] ++;			
		}
		return 0;
	}
}
right now this code only goes to i = 0. nothing else.
I have tried break; but that also keeps i at 0
Reply
#2

Why would you put return 0; there? if theres nothing there and doesnt meet requierments for the next if statement it just doesnt excecute anything
Reply
#3

Well basically this is under OnPlayerText. I want this to be executed and NO text to be returned to the chat box. However. Taking away return 0; will make the text a player inputs to show up in the chat box.
Reply
#4

So you dont want OnPlayerText returning anything and only your code? If so then just put return 0 at onplayertext like this:
pawn Код:
public OnPlayerText
{
    return 0;
}
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
Put it AFTER the loop.
Thank's for your input ******, Unfortunately putting the return after the loop did not solve the issue and allowed the text to appear in the chat box. Just as if I didn't have return 0; there at all. I have tried both return 0; and return 1;


Quote:
Originally Posted by thimo
Посмотреть сообщение
So you dont want OnPlayerText returning anything and only your code? If so then just put return 0 at onplayertext like this:
pawn Код:
public OnPlayerText
{
    return 0;
}
Well it's a little more complicated than that. This code in my OP is under a function that is under OnPlayerText. There is plenty more code under OnPlayerText that all works fine, however executing the function containing the loop in my OP causes the text to appear in the main chat box.

I hope i am making myself understandable, It's a bit complicated for me to find a way to explain it. I have been working on this for a few hours now.
Reply
#6

Please post your entire callback.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)