About return
#1

If i don't return anything in a timer seted from OnGameModeInit , or if I don't return anything from a SA:MP Callback , will this make problems for my server ? Like ... to make ping ... or another bad things ?

Thanks
Reply
#2

What do you mean with returning anything in a timer?
Reply
#3

He means:

pawn Код:
public Example()
{
}
Instead of:

pawn Код:
public Example()
{
return 1;
}
Reply
#4

Yes ...
Reply
#5

Somebody can help me ?
Reply
#6

There must be a return. Else compiler will show an error or what
Reply
#7

Nice joke
Reply
#8

You aren't forced to, but it doesn't hurt if you do
pawn Код:
return;
at the end.
Reply
#9

I use them because it will end that section of code. I don't know the fancy words for it but it stops the code where it's at. At least that's my understanding of it. Let me show you...

pawn Код:
public Function(blah)
{
  if(blah == 1)
  {
     //Some code
  }
  if(blah == 2)
  {
     //Some code
  }
  return 1;
}
Now if blah equals 1, it's going to go in there and execute that code. After that, if there's no return, it will jump out and check if blah equals 2. Well this is unnecessary because we already saw that it equaled 1. If there's a return in there, it will stop after it sees it's at 1. You could return whatever number you wanted to. It just depends on the code. If you had some more code at the bottom of those if statements, then you wouldn't want to have a return in them.
Reply
#10

1. Stops the code in certain points.

2. You can return a value for some function/public like return Money[playerid];

3. Example for onplayertext, if you put return 0; it wont shot the samp default chat. return 1 will show.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)