Raised This Month: $32 Target: $400
 8% 

Solved Global Handles


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 02-25-2018 , 16:07   Global Handles
Reply With Quote #1

Hey,
So I have been coding in SourcePawn for a while now, however I have never realized whether or not you need to set a handle equal to null when you define it as a global handle.

Here is what I mean:

Defining a handle and setting it equal to null:
PHP Code:
#include <sourcemod>

ConVar g_cvConVar null
Defining a handle without setting it equal to null:
PHP Code:
#include <sourcemod>

ConVar g_cvConVar
When you define a global handle, do you need to set it equal to null, or does defining it automatically set it equal to null?

Thanks!

Last edited by ThatKidWhoGames; 02-27-2018 at 10:20.
ThatKidWhoGames is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 02-25-2018 , 16:54   Re: Global Handles
Reply With Quote #2

Quote:
Originally Posted by ThatKidWhoGames View Post
When you define a global handle, do you need to set it equal to null, or does defining it automatically set it equal to null?
Declarations will default initialize to null, some people prefer to be explicit about it.
headline is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 02-25-2018 , 17:13   Re: Global Handles
Reply With Quote #3

Quote:
Originally Posted by Headline View Post
Declarations will default initialize to null, some people prefer to be explicit about it.
Thank you very much!
ThatKidWhoGames 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 00:39.


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