Raised This Month: $51 Target: $400
 12% 

[TUT] The Use of Static Variables


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-20-2008 , 15:08   Re: [TUT] The Use of Static Variables
Reply With Quote #21

szName[128] is useless since AFAIK player's name can not be over 32 characters.
__________________
Arkshine is offline
Dr. Jan Itor
Veteran Member
Join Date: Mar 2008
Location: there.
Old 07-20-2008 , 15:10   Re: [TUT] The Use of Static Variables
Reply With Quote #22

well that was a bad example but lets say in this usage

whats the difference on
Code:
  static website[128]
    get_pcvar_string(rickroll_link, website, 127)
    format(szMotd , 255 , "%s" , rickroll_link);
and
Code:
   static website[33]
    get_pcvar_string(rickroll_link, website, 32)
    format(szMotd , 255 , "%s" , rickroll_link);
__________________
Dr. Jan Itor is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 07-20-2008 , 15:16   Re: [TUT] The Use of Static Variables
Reply With Quote #23

website[128] / website[33] ; you see yourself. The size of array is different. How is related to this tutorial ? I don't understand.
__________________
Arkshine is offline
Sherazaa
Member
Join Date: Jun 2012
Old 03-19-2013 , 14:53   Re: [TUT] The Use of Static Variables
Reply With Quote #24

Nice tut !

But i've one questions :

"static variable already exists with contents "Hawk552\0..."
get name -> now looks like "zomg\052\0...", however it ends at the first \0 so the trailing 52 doesn't matter
print name"

I do not understand why you write "Hawk552\0..." and "zomg\052\0..." and not just "Hawk552/..." and "zomg/Hawk552/..." ?

Thanks
__________________
[B]Bhop & Kz Player
Sherazaa is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-20-2013 , 01:36   Re: [TUT] The Use of Static Variables
Reply With Quote #25

Bacause natives that fill an array with strings add a 0 at the end of each string, so it can be detected as the end of the string
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Sherazaa
Member
Join Date: Jun 2012
Old 03-20-2013 , 12:56   Re: [TUT] The Use of Static Variables
Reply With Quote #26

Thanks ConnorMcLeod
__________________
[B]Bhop & Kz Player
Sherazaa 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 14:43.


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