AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How i can make a const and use them with containi (https://forums.alliedmods.net/showthread.php?t=126585)

#8 SickneSS 05-11-2010 06:15

How i can make a const and use them with containi
 
I have a doubt about this

How i can make a const and use them with containi...

Example...
PHP Code:

new const Nicks[] = { "Name1","Name2","Name3" 

PHP Code:

new name[32]
get_user_name(id,name,31)
if(
containi(name,"Nicks") != -1)
//Code... 

I'm sorry but I never used a const :P

wrecked_ 05-11-2010 07:07

Re: How i can make a const and use them with containi
 
Code:
new const arrays[][] = {     "name1",     "name2",     "name3" } func( id ) {     new name[32]     get_user_name( id, name, 31 )     for( new i = 0; i < sizeof arrays; i++ )     {         if( containi( name, arrays[i] ) != -1 )         {             // ...         }     } }

#8 SickneSS 05-11-2010 14:52

Re: How i can make a const and use them with containi
 
10x.
Why i need to use with a loop? Just for know :P

wrecked_ 05-11-2010 15:28

Re: How i can make a const and use them with containi
 
The loop allows you to run through each of the array cells and compare each one to the current string you have.

#8 SickneSS 05-11-2010 15:34

Re: How i can make a const and use them with containi
 
Thanks

wrecked_ 05-11-2010 15:36

Re: How i can make a const and use them with containi
 
No problem.


All times are GMT -4. The time now is 03:46.

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