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?