This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Couple of questions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Blinx
Senior Member
Join Date: Oct 2013
Old 09-20-2016 , 08:40   Couple of questions
Reply With Quote #1

What does defining a function as "stock" or "void" practically do?

Is the only difference between a normal variable and a value that is defined (i.e. #define age 16 vs. new age = 16;) is that a defined variable cannot be changed? (which I assume has some overhead influences otherwise there'd be no point in it).

Is there a reference somewhere for Sourcemod's syntax for handling bitflags?

What is the purpose of gamedata, and why do some plugins need it?

Thanks in advance.

Last edited by Blinx; 09-20-2016 at 08:40.
Blinx is offline
xines
Veteran Member
Join Date: Aug 2013
Location: Denmark
Old 09-20-2016 , 09:33   Re: Couple of questions
Reply With Quote #2

1. Stock: A normal function provided by an include file. If unused, it won't be compiled.
Void: Basicly a function with no returns needed.

2. A defined age 16 can't be changed as you said wich is true, also a defined value takes no memory in the processor, where the integer variable can be modifyed under any desired circumstances tho it takes up a little bytes to store values, the modify of the integer variable can be used to store data, like client indexes and what else, so yes big point in using the integer variable, but it all depends on what your trying to do.

3. What do you want to know about bitflags, like what are you trying to accomplish?

4. Gamedata is typically changed by the game itself, for us to modify some values we need this gamedata, there should be plenty of information about gamedata laying around, just search.


If i'm totally wrong about anything said above feel free to correct me.
__________________
xines is offline
Impact123
Veteran Member
Join Date: Oct 2011
Location: Germany
Old 09-20-2016 , 09:52   Re: Couple of questions
Reply With Quote #3

xines already answered most of it so I'll just give you some references.

Stocks

Stocks are mentioned in the wiki and in asherkin's answer to a similar question. You can also read about them in the pawn language guide on page 83.

Defines
Defines are processed during the compilation process. You can read about them in the pawn language guide on page 92.

Bitwise
Bugsy talked a bit about this (it's amxx but applicable). As this is not a sourcemod exclusive thing (neither are the defines) i recommend searching for "bitwise operators" or "bitwise operators site:forums.alliedmods.net". You can also read a bit about it in the pawn language guide starting on page 104.
__________________

Last edited by Impact123; 09-20-2016 at 10:05.
Impact123 is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 09-20-2016 , 10:40   Re: Couple of questions
Reply With Quote #4

Gamedata's purpose is to help Sourcemod locate functions, C++ offsets, and global variables in Valve's code that Valve doesn't explicity expose on its server API or SDK. Finding them requires some reverse engineering of the game.

Last edited by Potato Uno; 09-20-2016 at 10:41.
Potato Uno is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 12:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode