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

Can somebody explain this to me?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blAck.
Member
Join Date: Jun 2018
Old 07-19-2018 , 18:44   Can somebody explain this to me?
Reply With Quote #1

Since I'm new, I was wondering what does 'sz' stands for?
I've seen some stuff like szName, szNameReceiver, szAmount, szCommand...
Please can somebody explain this to me?
blAck. is offline
Ghosted
Veteran Member
Join Date: Apr 2015
Location: Georgia
Old 07-19-2018 , 18:49   Re: Can somebody explain this to me?
Reply With Quote #2

I don't know what sz means but we use sz to know if variable is string (for readability & not for compiling)
__________________

[MOD] CS Weapon Mod V1.7.1
[MM] MetaMod-C V1.0
[MOD] CS NPC Mod (5%)


Probably Left AM
Ghosted is offline
blAck.
Member
Join Date: Jun 2018
Old 07-19-2018 , 19:02   Re: Can somebody explain this to me?
Reply With Quote #3

Quote:
Originally Posted by Ghosted View Post
I don't know what sz means but we use sz to know if variable is string (for readability & not for compiling)
I still don't get it.. Can you explain a little bit more?
blAck. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-19-2018 , 20:57   Re: Can somebody explain this to me?
Reply With Quote #4

Quote:
Originally Posted by blAck. View Post
I still don't get it.. Can you explain a little bit more?
sz means "string of characters, terminated by a null character" (z stands for zero).
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-19-2018 , 22:30   Re: Can somebody explain this to me?
Reply With Quote #5

Quote:
Originally Posted by blAck. View Post
Since I'm new, I was wondering what does 'sz' stands for?
I've seen some stuff like szName, szNameReceiver, szAmount, szCommand...
Please can somebody explain this to me?
"string, zero-terminated"

Meaning that the end of the string is denoted by a value of zero. This is why you must always size an array being used as a string with one extra element (for the zero-termination).

Code:
szString[7] = "hello"

string[0] = 'h' = 104
string[1] = 'e' = 101
string[2] = 'l' = 108
string[3] = 'l' = 108
string[4] = 'o' = 111
string[5] = EOS = 0
string[6] =
I didn't show a value for string[6] because it is ignored because it comes after the zero-termination; it could be any value.

Prefixing is not required but because Pawn is typeless, it is generally recommended to prefix your variable so that people, including yourself, know what you are actually using the variable for.

Other often used prefixes:

Code:
integer:  i
boolean:  b
Float:  f
string:  sz
For more about basic Pawn programming, you should look through the tutorials. This one is really good. Other tutorials can be found here.
__________________
fysiks is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-20-2018 , 10:42   Re: Can somebody explain this to me?
Reply With Quote #6

To be more easily and specific, it's just a tag to use when declaring variables that will store strings (words, chars, etc).
__________________








CrazY. is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 07-20-2018 , 15:02   Re: Can somebody explain this to me?
Reply With Quote #7

Quote:
Originally Posted by CrazY. View Post
To be more easily and specific, it's just a tag to use when declaring variables that will store strings (words, chars, etc).
In fact, it isn't a tag, it's a sort of a name convention, like Hungarian Notation.

Tags are:
1. bool:
2. Float:
3. Array:
4. Trie:
and others.
__________________
My English is A0
E1_531G is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 07-20-2018 , 15:07   Re: Can somebody explain this to me?
Reply With Quote #8

I said "tag" to be more specific.
https://forums.alliedmods.net/showthread.php?t=308561
__________________








CrazY. is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 07-20-2018 , 16:57   Re: Can somebody explain this to me?
Reply With Quote #9

'Prefix' is the good word here.
__________________
My English is A0
E1_531G is offline
Reply


Thread Tools
Display Modes

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 17:38.


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