Chameleon available only to user with flags

Want to talk about war3ft or make suggestions? Post them here

Moderator: Forum Moderator

Post Reply
dancer
Peon
Posts: 4
Joined: Thu Jan 19, 2012 2:47 pm

Chameleon available only to user with flags

Post by dancer » Sun Jan 22, 2012 1:25 pm

I am wondering how to make chameleon restricted only for VIP/admin? I tested the way recommended by whosyourdaddy but it seems to that isn't working :?
When I try to compile war3ft.sma in local compiler I have errors like that

Image


And that is my menus.inl ' s part :

Code: Select all

// All other cases
      else
      {
         new bool:bAllowRace = true;

         if(i == 9 && !(get_user_flags( id ) & ADMIN_LEVEL_A) )
         bAllowRace = false;

         // Check to see if the user can choose this race (are there too many of this race?)
         if ( bAllowRace )
         {
            pos += formatex( szMenu[pos], 512-pos, "\w%d. %s\y\R%s^n", i + 1-A, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );

            iKeys |= (1<<i-A);
         }

         // If not, display the race, but don't give them a key to press
         else
         {
            pos += formatex( szMenu[pos], 512-pos, "\y%d. %s\y\R%s^n", i + 1-A, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );
			}
		}

	}
I just change the Z flag to A flag and z symbol to A symbol.
Am I doing something wrong? Or maybe is there any another way to restrict chameleon only for admin/VIP ?
Please reply.

MadnesS
Peon
Posts: 2
Joined: Wed Jan 18, 2012 4:26 am

Re: Chameleon available only to user with flags

Post by MadnesS » Tue Jan 24, 2012 8:15 am

Hello dancer,

Simply remove this "A"'s from the code, cuz they are useless for your purposes. Expression "i + 1" in formatex function call stands for just nice output of valid keys in menu.
I didn't test it but it should look like:

Code: Select all

// All other cases
      else
      {
         new bool:bAllowRace = true;

         if(i == 9 && !(get_user_flags( id ) & ADMIN_LEVEL_A) )
         bAllowRace = false;

         // Check to see if the user can choose this race (are there too many of this race?)
         if ( bAllowRace )
         {
            pos += formatex( szMenu[pos], 512-pos, "\w%d. %s\y\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );

            iKeys |= (1<<i);
         }

         // If not, display the race, but don't give them a key to press
         else
         {
            pos += formatex( szMenu[pos], 512-pos, "\y%d. %s\y\R%s^n", i + 1, szRaceName[i], ( (get_pcvar_num( CVAR_wc3_save_xp )) ? szXP : " " ) );
         }
      }

   }

dancer
Peon
Posts: 4
Joined: Thu Jan 19, 2012 2:47 pm

Re: Chameleon available only to user with flags

Post by dancer » Tue Jan 24, 2012 2:10 pm

Thanks a lot.
Now there is no errors when compile but it doesn't give any effects. I uploaded the recompiled plugin (war3ft.amxx) on the server but it doesn't work :/ Still all players can choose chameleon race. Have you any ideas how to change it?

Post Reply