Maybe you remember helping me with a freegun granting plugin that allows certain pplayers to recieve free weapons once per map. See below for code:
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "Freegun"
#define VERSION "1.0"
#define AUTHOR "|sXe| Mr. Foster"
new bool:user_gothisgun[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("freegun", "cmd_weapon", ADMIN_LEVEL_H, "<weapon(m4, ak)>")
}
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(id,print_console,"You have received your M4A1. Thank you for donating to our server.")
client_print(0,print_chat, "*****%s used his freegun power to give himself an M4A1.*****", name)
client_print(0,print_chat, "*****Say /rewards to learn about dontating to our server and recieving rewards.*****", 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(id,print_console,"You have received your AK47. Thank you for donating to our server.")
client_print(0,print_chat, "*****%s used his freegun power to give himself an AK47.*****", name)
client_print(0,print_chat, "*****Say /rewards to learn about dontating to our server and recieving rewards.*****", name)
user_gothisgun[id] = true
}
return PLUGIN_HANDLED
}
I am looking to edit this plugin so that it allows users to access this feature 3 times per map. I tried to do it myself but nothing works....
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#define PLUGIN "Freegun"
#define VERSION "1.0"
#define AUTHOR "|sXe| Mr. Foster"
new bool:user_gothisgun[33]
new bool:user_gothisgun2[33]
new bool:user_gothisgun3[33]
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("freegun", "cmd_weapon", ADMIN_LEVEL_H, "<weapon(m4, ak)>")
}
public client_putinserver(id) {
user_gothisgun[id] = false
user_gothisgun2[id] = false
user_gothisgun3[id] = false
}
public cmd_weapon(id, level, cid)
{
if(!cmd_access(id, level, cid, 2))
return PLUGIN_HANDLED
new whatwassaid[32]
read_argv(1, whatwassaid, 31)
new name[32]
get_user_name(id, name, 31)
if(user_gothisgun[id])
if(equali(whatwassaid,"m4", 2))
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
client_print(id,print_console,"You have received your M4A1. Thank you for donating to our server.")
client_print(id,print_console,"You have used your last freegun access for this map. Please wait until next map before trying again.")
client_print(0,print_chat, "%s used his freegun power to give himself an M4A1.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", name)
user_gothisgun2[id] = true
}
else if(equali(whatwassaid,"ak", 2))
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
client_print(id,print_console,"You have received your AK47. Thank you for donating to our server.")
client_print(id,print_console,"You have used your last freegun access for this map. Please wait until next map before trying again.")
client_print(0,print_chat, "%s used his freegun power to give himself an AK47.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", name)
user_gothisgun2[id] = true
}
return PLUGIN_HANDLED
if(user_gothisgun2[id])
if(equali(whatwassaid,"m4", 2))
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
client_print(id,print_console,"You have received your M4A1. Thank you for donating to our server.")
client_print(id,print_console,"You have used your freegun access for the second time this map. You have 1 use remaining.")
client_print(0,print_chat, "%s used his freegun power to give himself an M4A1.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", name)
user_gothisgun3[id] = true
}
else if(equali(whatwassaid,"ak", 2))
{
give_item(id, "weapon_ak47")
cs_set_user_bpammo(id, CSW_AK47, 90)
client_print(id,print_console,"You have received your AK47. Thank you for donating to our server.")
client_print(id,print_console,"You have used your freegun access for the second time this map. You have 1 use remaining.")
client_print(0,print_chat, "%s used his freegun power to give himself an AK47.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", name)
user_gothisgun3[id] = true
}
return PLUGIN_HANDLED
if(user_gothisgun3[id])
return PLUGIN_HANDLED
if(equali(whatwassaid,"m4", 2))
{
give_item(id, "weapon_m4a1")
cs_set_user_bpammo(id, CSW_M4A1, 90)
client_print(id,print_console,"You have received your M4A1, Thank you for donating to our server.")
client_print(id,print_console,"You have used your freegun access for the first time this map. You have 2 uses remaining.")
client_print(0,print_chat, "%s used his freegun power to give himself an M4A1.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", 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(id,print_console,"You have received your AK47. Thank you for donating to our server.")
client_print(id,print_console,"You have used your freegun access for the first time this map. You have 2 uses remaining.")
client_print(0,print_chat, "%s used his freegun power to give himself an AK47.", name)
client_print(0,print_chat, "Say /rewards to learn about dontating to our server and recieving rewards.", name)
user_gothisgun[id] = true
}
return PLUGIN_HANDLED
}