AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Restricting an item on shop to one per map. (https://forums.alliedmods.net/showthread.php?t=121691)

Kreation 03-18-2010 18:03

Restricting an item on shop to one per map.
 
So as the title says how would I make it so that an item
on a shop for example could be restricted to only
using it once per map..?

wrecked_ 03-18-2010 18:38

Re: Restricting an item on shop to one per map.
 
Code:
#define MAX_PLAYERS 32 new bool:b_Used[MAX_PLAYERS+1] public menufunction( id ) {     // ...         if( !b_Used[id] )     {         menu_additem( menu, "Item", "1", 0 )     } } public handler( id, menu, item ) {     // ...         switch( key )     {         case 1:         {             // ...                         b_Used[id] = true         }     } }

Kreation 03-18-2010 19:37

Re: Restricting an item on shop to one per map.
 
That is for once per map? I didn't know that.
:oops:

wrecked_ 03-18-2010 19:38

Re: Restricting an item on shop to one per map.
 
Quote:

Originally Posted by Kreation (Post 1121884)
That is for once per map? I didn't know that.
:oops:

All variables reset to their original state when the map starts (since each plugin reloads), and a bool's default value is false. So yeah.


All times are GMT -4. The time now is 08:38.

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