if i understand u correctly try this..
u may also have to go into your amxmodx/config/cvars folder and add this line "amx_npckill" "0" "1" "u"
Code:
#include <amxmodx>
#define PLUGIN "NPC Protector"
#define VERSION "1.0"
#define AUTHOR "Dark Kingdom"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_npckill","1")
register_concmd("killnpc","killnpc")
}
public killnpc(id) {
new cvarkill = get_cvar_num("npckill")
if(cvarkill == 1) //off
{
client_print(id,print_chat,"[NPC Protector] ADMIN has turned the pluginoff, NPC's can be killed.")
}
else if{cvarkill == 0) //on
}
client_print(id,print_chat,"[NPC Protector] ADMIN has turned the plugin on, NPC's can't be killed.")
}
}
OR:
try somin like this so that each time u type npckill in console it will turn it on and off instean of going into ur amxmodx menu....but hey im pro at coding just tryin to give ideas/help
Code:
#include <amxmodx>
#define PLUGIN "NPC Protector"
#define VERSION "1.0"
#define AUTHOR "Dark Kingdom"
new check = 0
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("amx_npckill","1")
register_concmd("killnpc","killnpc")
}
public killnpc(id) {
new cvarkill
if(check == 0)
{
check = 1
set_cvar_num("npckill",1)
cvarkill = get_cvar_num("npckill")
if(cvarkill == 1) //off
{
client_print(id,print_chat,"[NPC Protector] ADMIN has turned the pluginoff, NPC's can be killed.")
return PLUGIN_HANDLED
}
}
if(check == 1)
{
check = 0
set_cvar_num("npckill",0)
cvarkill = get_cvar_num("npckill")
if{cvarkill == 0) //on
}
client_print(id,print_chat,"[NPC Protector] ADMIN has turned the plugin on, NPC's can't be killed.")
return PLUGIN_HANDLED
}
}
}
return PLUGIN_CONTINUE