Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "AutoWeapons"
#define VERSION "1.0"
#define AUTHOR "[CHEEZ-IT]"
new bool:user_gothisgun[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say freegun", "cmd_weapon", ADMIN_SLAY, "<weapon(m4, ak)>")
set_task(15.0, "sayplugin", _,_,_, "b")
}
public client_putinserver(id) {
user_gothisgun[id] = false
}
public cmd_weapon(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
if(user_gothisgun[id])
return PLUGIN_HANDLED
new whatwassaid[32]
read_argv(1, whatwassaid, 31)
new name[32]
get_user_name(id, name, 31)
if(equali(whatwassaid,"m4", 2))
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
client_print(0,print_chat, "%s used his freegun power to give himself an M4A1. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)
user_gothisgun[id] = true
}
else if(equali(whatwassaid,"ak", 2))
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
client_print(0, print_chat, "%s used his freegun power to give himself an AK47. Please visit <a href="http://www.sXeGaming.cjb.net" target="_blank" rel="nofollow noopener">www.sXeGaming.cjb.net</a> to learn about donating to our server and recieving freegun access.", name)
user_gothisgun[id] = true
}
return PLUGIN_HANDLED
}
public sayplugin()
{
for(new id = 1; id <= get_maxplayers(); id++)
{
client_print(id, print_chat, "|sXe| Clan Pub Server: Freegun access is enabled. Those with freegun access type freegun ak or freegun m4 in console to recieve cooresponding weapon.")
set_hudmessage(0, 0, 0, 0.57, 0.93, 0, 6.0, 12.0)
show_hudmessage(id, "If you have freegun access, say freegun to receive your gun.")
}
}
flag to repeat. So it will repeat the message every 15 seconds.