Max Usage Of A Item In Shop
Hello.
I am running a RECSDM mod. I have added a Shop plugin. I want to add limit of each item and limit get reset after getting killed. Thank You |
Re: Max Usage Of A Item In Shop
Suggestions / Requests , wrong section buddy and provide sma to the item shop next time.
|
Re: Max Usage Of A Item In Shop
Quote:
-------------- Create a global variable with 2 dimensions - the player index and item index. Increase [id][item] by 1 when buying the item. Check if [id][item] reached your desired limit, stop the code if it did. When the player dies, loop through all player indexes and use arrayset() to reset the limit for each item. |
Re: Max Usage Of A Item In Shop
Quote:
|
Re: Max Usage Of A Item In Shop
Can u define me with some examples? it would be great.
|
Re: Max Usage Of A Item In Shop
That's just one way of doing it
PHP Code:
|
Re: Max Usage Of A Item In Shop
That's a global limit for all items, not per player.
|
Re: Max Usage Of A Item In Shop
Normally you would do something like this instead.
PHP Code:
|
Re: Max Usage Of A Item In Shop
Yes, my bad.
Ideally then it should be somewhat like this PHP Code:
|
Re: Max Usage Of A Item In Shop
PHP Code:
If you're on AMXX 1.9 or greater, consider ditching the formatex function and using fmt(). You'd get this: PHP Code:
Also, there is no need to increment ItemUsed in there if the condition results in false, just put it under the switch statement. |
All times are GMT -4. The time now is 20:52. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.