View Single Post
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 03-25-2021 , 12:28   Re: Max Usage Of A Item In Shop
Reply With Quote #10

PHP Code:
enum _:Items
{
    
Name[64],
    
Limit[33]

Why is Limit an array? It only takes one number. Name is an array of characters or a string with a maximum of 64 characters available in this case.


If you're on AMXX 1.9 or greater, consider ditching the formatex function and using fmt(). You'd get this:
PHP Code:
    for(new ii<2i++)
    {
        static 
szInfo[3]
        
        
num_to_str(iszInfocharsmax(szInfo))
        
menu_additem(menufmt("%s"szItemInfo[i][Name]), szInfo)
    } 
Be careful though, if you were to use fmt inside another fmt, you'd get errors, but this is a much better approach in your case.


Also, there is no need to increment ItemUsed in there if the condition results in false, just put it under the switch statement.

Last edited by redivcram; 03-25-2021 at 12:29.
redivcram is offline