Few Questions
#1

I'm starting out with pawn and i got a few questions.

I understand tht you always start with #include <a_samp>
but why does you use a_samp specifically..What is a samp?

Also what is the difference between funtions and callbacks because i can't seem to find the difference between the two. Can you give me an example of each please?

If main () is called when the server starts why can one simply put it at the end? Doesn't the computer run the program step by step line by line or can it also start at the end, then go to the beginning and then work in the middle?

I always see public betfore something. Why does on need to type in public? whats the use of it?

And can someone also please explain OnGameModeInit?

Sorry for all the questions but im trying to learn pawn and basically know extremely little thus far:/
Reply
#2

There's no need to make a new thread - your other one is basically the same as what you're asking now.

I'm tellin ya man, read the pawn-lang.pdf lol
Reply
#3

I don't know why would you wanna know something your gonna use rarely ( #include ) but whatever it's explained in the other thread.. samp means San Andreas Multi Player if you wouldn't have #include <a_samp> you wouldn't be scripting in pawno for sa:mp ..
a_samp is the library for samp so you can use functions that link with the game
Reply
#4

kyle, try remove that
pawn Код:
#include a_samp
then compile ur script ^^ no errors ? -,-
Reply
#5

You need to include the a_samp.inc file because it has all of SA:MP's main PAWN functions. Without it you couldn't write a mode to work with a SA:MP server.

A function is basically a line of code that does something directly. Basically, a function is a "shortcut" to a callback. The callback has all of the code to operate the function inside of it.

In SA:MP, the code is not called directly one thing after another. SA:MP calls things as they're needed- as long as the code is there, it will execute it.

When you see "public" before things, it's basically saying "Hey, I'm a callback." There is also "forward", that will pretty much make the "callback" recognizable by the server.

OnGameModeInit() is called when the GAME MODE is booted up for the first time. You can put functions/operations inside that callback to perform tasks when the GAME MODE boots up.

--

It's early, so these explanations may be somewhat incorrect. If you can get a response from ******, your answers will be given to the fullest extent.
Reply
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
You need to include the a_samp.inc file because it has all of SA:MP's main PAWN functions. Without it you couldn't write a mode to work with a SA:MP server.

A function is basically a line of code that does something directly. Basically, a function is a "shortcut" to a callback. The callback has all of the code to operate the function inside of it.

In SA:MP, the code is not called directly one thing after another. SA:MP calls things as they're needed- as long as the code is there, it will execute it.

When you see "public" before things, it's basically saying "Hey, I'm a callback." There is also "forward", that will pretty much make the "callback" recognizable by the server.

OnGameModeInit() is called when the GAME MODE is booted up for the first time. You can put functions/operations inside that callback to perform tasks when the GAME MODE boots up.

--

It's early, so these explanations may be somewhat incorrect. If you can get a response from ******, your answers will be given to the fullest extent.
Thank you, this answered some of my questions
Reply
#7

I suggest you something, don't start with a blank gamemode because you will be like
"Wtf? i'm gonna to script this ***** ?", start with a script maded by other people and edit it

from message , to function , from adding a command , to adding a system and more....more..
because is very hard to start with a blank script


Also , i expalined you with a_samp is, is a library ( a txt file ( text doccument) with a lot of function)


The difference between function and callbacks is the next

Functions:
- You can script it , and don't give errors if not scripted good , until you use it
- Is lower than a callback
- you can create an extra function , like adding more function into a one and making that function the best tool for you
-and more...

Callback:
Is need to use forward , and you will ask "But , why i must add forward ..?" , because that forward practicaly define the callback, without them , is something like use a command like if that command doesn't exist
- Is used only when you connect it to whatever you want, or when you create a timer
- is faster than function
and more...

main() , doesn't need to be put in top of script , this doesn't need more info about this , watch at scripting basics

and i know a lot more you can pm me , and give you your adrees, so i can help you
Sorry about grammar mistakes , i write fast
Reply
#8

Quote:
Originally Posted by XStormiest
Посмотреть сообщение
I suggest you something, don't start with a blank gamemode because you will be like
"Wtf? i'm gonna to script this ***** ?", start with a script maded by other people and edit it

from message , to function , from adding a command , to adding a system and more....more..
because is very hard to start with a blank script


Also , i expalined you with a_samp is, is a library ( a txt file ( text doccument) with a lot of function)


The difference between function and callbacks is the next

Functions:
- You can script it , and don't give errors if not scripted good , until you use it
- Is lower than a callback
- you can create an extra function , like adding more function into a one and making that function the best tool for you
-and more...

Callback:
Is need to use forward , and you will ask "But , why i must add forward ..?" , because that forward practicaly define the callback, without them , is something like use a command like if that command doesn't exist
- Is used only when you connect it to whatever you want, or when you create a timer
- is faster than function
and more...

main() , doesn't need to be put in top of script , this doesn't need more info about this , watch at scripting basics

and i know a lot more you can pm me , and give you your adrees, so i can help you
Sorry about grammar mistakes , i write fast
Thank you so much for taking your time to explain this. I know its not nice to keep explaining and helping people that ask the same questions over and over Lol so thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)