Raised This Month: $ Target: $400
 0% 

Problem with registering a command.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
nadavafuta
Junior Member
Join Date: Oct 2008
Old 04-16-2009 , 11:47   Problem with registering a command.
Reply With Quote #1

I have this function:
Code:
public deleteAllBlocks(id, bool:bNotify)
{
    //make sure player has access to this command
    if (get_user_flags(id) & BM_ADMIN_LEVEL)
    {
        new bool:bDeleted;
        new blockCount = 0;
        new ent = -1;
        
        //find all blocks in the map
        while ((ent = find_ent_by_class(ent, gszBlockClassname)))
        {
            //delete the block
            bDeleted = deleteBlock(ent);
            
            //if block was successfully deleted
            if (bDeleted)
            {
                //increment counter for how many blocks have been deleted
                ++blockCount;
            }
        }
        
        //if some blocks were deleted
        if (blockCount > 0)
        {
            //get players name
            new szName[32];
            get_user_name(id, szName, 32);
            
            //iterate through all players
            for (new i = 1; i <= 32; ++i)
            {
                //make sure nobody is grabbing a block because they've all been deleted!
                gGrabbed[id] = 0;
                
                //make sure player is connected
                if (is_user_connected(i))
                {
                    //notify all admins that the player deleted all the blocks
                    if (bNotify && get_user_flags(i) & BM_ADMIN_LEVEL)
                    {
                        client_print(i, print_chat, "%s'%s' deleted all the blocks from the map. Total blocks: %d", gszPrefix, szName, blockCount);
                    }
                }
            }
        }
    }
}
And I registed it like that:
Code:
register_concmd("amx_bmdelete", "deleteAllBlocks", BM_ADMIN_LEVEL, "This will delete all of the blocks, and only the blocks.");
Now, It does what it is supposed to do, except for the notifying part -
I was guessing what I need to do is change the registration of the command to:
Code:
register_concmd("amx_bmdelete", "deleteAllBlocks(id, true)", BM_ADMIN_LEVEL, "This will delete all of the blocks, and only the blocks.");
so that the if sentence will get bNotify as true,
but It won't let it.

What do I need to do?
nadavafuta is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 02:18.


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