Slightly optimized
Code:
//This makes it so you can use the core AMX Mod X functions
//It "includes" the native definitions from includes\amxmodx.inc
#include <amxmodx>
#include <amxmisc>
#include <fun>
//Declare three string variables
new PLUGIN[]="Knife Match"
new AUTHOR[]="semaja2"
new VERSION[]="0.01"
//This is a public function.
//It is necessary to initialize your script under AMX Mod X.
//It takes no parameters, and is called right after map load.
public plugin_init()
{
//This is a function that takes three strings.
//It registers your function in AMX Mod X, and assigns some basic information.
register_plugin(PLUGIN, VERSION, AUTHOR)
//Sets cvars
register_concmd("amx_knifematch", "amx_knifematch", ADMIN_SLAY, "NO DESCRIPTION")
}
public amx_knifematch(id, level, cid)
{
if(cmd_access(id,level,cid,1))
return 0
new num = get_maxplayers(), i
//This function will fill the players[32] variable
// with valid player ids. num will contain the number
// of players that are valid.
for (i = 0; i <= num; i++)
{
strip_user_weapons(i)
}
return PLUGIN_HANDLED
}
EDIT: If you want to see a complete knife plugin, although I'm not sure if it works, you can go here:
http://forums.alliedmods.net/showthread.php?t=20059
__________________