#3

Quote:
Originally Posted by Juance
Посмотреть сообщение
Hello everyone. I have a little doubt about how to declare functions to use in the Gamemode

Код:
forward MyFunction();
public MyFunction() {

// rest of code

}

stock MyFunction(){

// rest of code

}

MyFunction(){

// rest of code

}
What are their differences and what is the recommended way?
Public functions allow you to define new entry points that the host application (the sa-mp server) can communicate with your script. The host application keeps track of all the public functions you create. You usually use public functions for callbacks but you can also declare public variables (maybe a plugin to communicate with your script?)

Stock functions are usually used in libraries, the compiler won't throw the warning 203 (symbol is never used: "MyFunction") if you're not using a certain stock function as it won't include it.

PHP код:
MyFunction(){
// rest of code

You would use a function like that if you're sure you will use it, if you wind up not using a function like that you would get a warning:

Код:
warning 203: symbol is never used: "MyFunction"
Reply


Messages In This Thread
Dude - by Juance - 06.01.2018, 16:22
Re: Dude - by jasperschellekens - 06.01.2018, 16:39
Re: Dude - by ThePhenix - 06.01.2018, 16:43
Re: Dude - by Juance - 06.01.2018, 17:13
Re: Dude - by Dayrion - 06.01.2018, 18:17
Re: Dude - by Juance - 06.01.2018, 20:31
Re: Dude - by Dayrion - 06.01.2018, 22:07
Re: Dude - by ThePhenix - 06.01.2018, 22:40

Forum Jump:


Users browsing this thread: 1 Guest(s)