[Simple Question] Should publics in FS return 1?
#1

So, I have a question when I am making FS - should its public methods return value 1? Or, should I change them to 0?
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{ //my stuff
return 1;
}
Reply
#2

it should return 1 only.
Reply
#3

Depends, some return 1, others 0, the exact same as a gamemode.
Make it simple and use it as if you're scripting a Game Mode, it doesn't differ.
Reply
#4

Thanks, I was concerned about it. I think someone once said here that it should return 0, he said it about OnDialogResponse
Reply
#5

You could always check the wiki page of the CallBack, there is always a note of what value should it return.
For example OnDialogResponse returns 0, and it's noted in the wiki page.
Reply
#6

Thanks guys for answering so quickly
Reply
#7

Oke I dont make filter scripts but the way I understand returns is that...

Return 1; All fine tge public was a success now stop running it.

Return Value; means pass this value to the location which called this function then stop running it

Return 0; means command failed.. Or return nothing to the caller.

If your using it in a filter script I understood that you removed the returns, and the compiler complains but ignore that, and it allows the information to pass to tge other scripts. Bars in mind I've only made about 13 filter scripts most of which years ago.


Functions per made by samp such as on dialog response should be the default return, ondialog is 0
Reply
#8

Different callbacks handle returns differently. Some callbacks don't handle returns, such as OnPlayerSpawn - returning 0 in a FS won't stop it being called in a FS. For OnPlayerCommandText, return 1 signifies that the command has been processed in the FS and it won't be called in the GM.

One notable thing is that to use OnRconCommand in your gamemode, it must be used in a filterscript.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)