Hey i am writing a plugin for my server which enables server regulars to say "freegun ak" or "freegun m4" once per map to recieve the cooresponding weapon. I have edited a plugin that allows them to say "freegun XX" but i need help limiting it to only one use per map. Here is my code so far:
Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#define PLUGIN "AutoWeapons"
#define VERSION "1.0"
#define AUTHOR "[CHEEZ-IT]"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("freegun", "cmd_weapon", ADMIN_SLAY, "<weapon(m4, ak)>")
set_task(15.0, "sayplugin", 0, "", 0, "", 1)
}
public cmd_weapon(id){
new whatwassaid[32]
read_argv(1, whatwassaid, 31)
if(equali(whatwassaid,"m4")){
give_item(id, "weapon_m4a1")
give_item(id, "weapon_m4a1")
give_item(id, "weapon_m4a1")
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.", id)
}
if(equali(whatwassaid,"ak")){
give_item(id, "weapon_ak47")
give_item(id, "weapon_ak47")
give_item(id, "weapon_ak47")
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.", id)
}
return PLUGIN_HANDLED
}
public sayplugin(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.")
}
I have a very limited knowlege of the small language so any help is greatly appreciated.