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


Raised This Month: $ Target: $400
 0% 

[TUT] Enumerations (enum)


Post New Thread Reply   
 
Thread Tools Display Modes
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-18-2012 , 15:12   Re: [TUT] Enumerations (enum)
Reply With Quote #81

Uncasting. Generally a tag is applied like that : tag:variable.
When you do _:variable, it means basically you remove the tag for the current expression.
__________________
Arkshine is offline
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 12-18-2012 , 15:43   Re: [TUT] Enumerations (enum)
Reply With Quote #82

Thank you Arkshine
__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 01-14-2013 , 15:56   Re: [TUT] Enumerations (enum)
Reply With Quote #83

I have a compile error when using charsmax
PHP Code:
new gsz_Motds[][MOTD] = {
    { 
"http://link1.com""Admin Rules"},
    { 
"http://link2.com""General Rules"},
    { 
"http://link3.com""Website Rules"},
    { 
"http://link4.com""Server Rules"},
    { 
"http://link5.com""^n^nBan times"}
}


enum _:MOTD
{
    
LINK[100] = 0,
    
TITLE[50],
    
ACCESS
}

BuildMenu()
{
    
gMenu menu_create("Rules Menu""menu_handler")
    
    new 
iCallBack menu_makecallback("handle_callback")
    
    new 
szInfo[4]
    new 
iSize sizeof gsz_Motds )
    
    for(new 
iiSizei++)
    {
        
formatex(szInfocharsmax(szInfo), "%d"i)
        
        while(
contain(gsz_Motds[i][TITLE], "^n") != -1)
        {
            
// Error: Expected token: "]", but found "-identifier-" on line 60
            
replace(gsz_Motds[i][TITLE], charsmax(gsz_Motds[i][TITLE]), "^n"""// Error is here ...
            
menu_addblank(gMenu)
        }
        
        
menu_additem(gMenugsz_Motds[i][TITLE], szInfo0gsz_Motds[i][ACCESS] ? iCallBack : -1)
    }

__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.

Last edited by pokemonmaster; 01-14-2013 at 15:57.
pokemonmaster is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2013 , 16:28   Re: [TUT] Enumerations (enum)
Reply With Quote #84

charsmax(gsz_Motds[][TITLE]). Remove i.
__________________
Arkshine is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 01-14-2013 , 16:51   Re: [TUT] Enumerations (enum)
Reply With Quote #85

Quote:
Originally Posted by Arkshine View Post
charsmax(gsz_Motds[][TITLE]). Remove i.
Although I didn't understand why it worked like that, thanks a lot,
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2013 , 17:22   Re: [TUT] Enumerations (enum)
Reply With Quote #86

charsmax() gives the size of an array, it's something replaced at compilation time. Therefore, you must work with constants, and you don't need to specify a specific index : charsmax( array[][] ) will give the size of the third dimension, charsmax( array[][TITLE] ) will give the size of the var TITLE.
__________________

Last edited by Arkshine; 01-14-2013 at 20:23.
Arkshine is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-14-2013 , 19:47   Re: [TUT] Enumerations (enum)
Reply With Quote #87

Quote:
Originally Posted by Arkshine View Post
charsmax( array[][] ) will give the size of the second third dimension
Corrected (Unless of course you are referring to the first dimension as the zeroth dimension ).

Code:
new array[23][45][67]
charsmax(array) = 23
charsmax(array[]) = 45
charsmax(array[][]) = 67
__________________
fysiks is online now
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 01-14-2013 , 20:22   Re: [TUT] Enumerations (enum)
Reply With Quote #88

Sure, you are right. Thanks for correcting me.
__________________
Arkshine is offline
Sherazaa
Member
Join Date: Jun 2012
Old 03-20-2013 , 14:05   Re: [TUT] Enumerations (enum)
Reply With Quote #89

Hi ! I've got some questions :
If you put the optional _: before the tag name, it means "that it is no longer a tag"... What is exactly a tag ?
__________________
[B]Bhop & Kz Player

Last edited by Sherazaa; 03-20-2013 at 14:28.
Sherazaa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-20-2013 , 14:28   Re: [TUT] Enumerations (enum)
Reply With Quote #90

Quote:
Originally Posted by Sherazaa View Post
Hi ! I've got some questions :
1/ If you put the optional _: before the tag name, it means that it is no longer a tag.
I really do not understand that ?

Have you got an great example ?
There's nothing to explain. If you add "_:" before the variable it is no longer tagged. Is there a specific instance of tag mismatch that you are trying to figure out?
__________________
fysiks is online now
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 23:47.


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