I made a small plugin just to start learning small but I come against some problems with it, how can i check if pa_lol is set to 0 and then stop the message from appearing whenever i say lol ??
Code:
/* Plugin generated by AMXX-Studio */
/* My first plugin ever!!!
The commands are
say lol - shows lol message
pa_lol 1|0 - 1 acivates lol message, 0 disables
pa_killswitch 1|0 - 1 activates kill, 0 disbles it
*/
#include <amxmodx>
public plugin_init()
{
register_plugin("killer_lol_plug", "0.1 beta", "Panais")
register_clcmd ( "say lol", "saylol", 0,"displays lol function" )
register_cvar ( "pa_lol", "1")
register_cvar ("pa_killswitch", "1")
register_concmd("pa_kill","do_kill",ADMIN_LEVEL_C," Kills people ")
}
public saylol(id) {
if (get_cvar_num("pa_lol")==1)//to display message
set_hudmessage(255, 0, 0, -1.0, -1.0, 0, 6.0, 12.0)
show_hudmessage(id, "I said lol :):):)")
return PLUGIN_HANDLED
}
public do_kill(id) { //kill function
if (get_cvar_num("pa_killswitch")==0) {
return PLUGIN_HANDLED
}
if (!(get_user_flags(id)&ADMIN_KICK)) {
console_print(id,"You have no access")
return PLUGIN_HANDLED
}
if (read_argc() == 0) { //verifies user 1
console_print(id,"You must specify a user first.")
return PLUGIN_HANDLED
}
new user[32], uid //verifies user 2
read_argv(1,user,32)
uid = find_player("bh",user)
if (uid == 0) {
console_print(id,"Invalid userid, please try again.")
return PLUGIN_HANDLED
}
user_kill (uid)
return PLUGIN_HANDLED
}