Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
new invifrags = 15 //set number of frags needed for invisibility
new weapfrags = 15 //set number of frags needed for weapon commands
public plugin_init()
{
register_plugin("VS Gameplay","0.1","ZiP*")
register_clcmd("say /ammo","weapon",ADMIN_USER,"all weapons")
register_clcmd("amx_invisible","invisible",ADMIN_USER,"invisibility")
register_clcmd("amx_visible","visible",ADMIN_USER,"visibility")
}
//WEAPON COMMANDS
// Id is the index of the player when a client uses a command
public weapon(id)
{
new kTeam = get_user_team(id)
client_print(0, 3, "DEBUG: weapon Team %i", kTeam)
// When the command is ran it checks if they are on team constant 1 and then checks if player frag
// is greater or equal to weapon frags. Both must be true to give weapon.
if(kTeam == 1 && (get_user_frags(id) >= weapfrags))
{
give_item(id,"weapon_vsstake") //Stake
give_item(id,"weapon_vsshotgun") // Shotgun
give_item(id,"weapon_vsshotgun")
give_item(id,"weapon_vsshotgun")
give_item(id,"weapon_vsshotgun")
give_item(id,"weapon_vsshotgun")
give_item(id,"weapon_vsshotgun")
give_item(id,"weapon_vsdbshotgun") //DBShotgun
give_item(id,"weapon_vsdbshotgun")
give_item(id,"weapon_vsdbshotgun")
give_item(id,"weapon_vsdbshotgun")
give_item(id,"weapon_vsdbshotgun")
give_item(id,"weapon_vsdbshotgun")
give_item(id,"weapon_vscolt") // Stake + Colt
give_item(id,"weapon_vsmp5") // MP5
give_item(id,"weapon_vsmp5")
give_item(id,"weapon_vsmp5")
give_item(id,"weapon_vsmp5")
give_item(id,"weapon_vsmp5")
give_item(id,"weapon_vsmp5")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscrossbow")
give_item(id,"weapon_vscue") // Stake (cue)
give_item(id,"weapon_vsthunderfive") // Thunderfive
give_item(id,"weapon_vsthunderfive")
give_item(id,"weapon_vsthunderfive")
give_item(id,"weapon_vsthunderfive")
give_item(id,"weapon_vsthunderfive")
give_item(id,"weapon_vsthunderfive")
give_item(id,"weapon_vswinchester")
give_item(id,"weapon_vswinchester")
give_item(id,"weapon_vswinchester")
give_item(id,"weapon_vswinchester")
give_item(id,"weapon_vswinchester")
give_item(id,"weapon_vswinchester")
client_print(id, print_chat, "*You have been given ammo!")
} else if(kTeam == 1 && (get_user_frags(id) < weapfrags)) {
client_print(id, print_chat, "*You need at least %i kills", weapfrags)
}
return PLUGIN_HANDLED
}
//INVISIBILITY
// Id is the index of the player that is use the command.
public invisible(id) {
// get the player team from the id.
new kTeam = get_user_team(id)
client_print(0, 3, "DEBUG: invis Team %i", kTeam)
if(kTeam == 2 && (get_user_frags(id) >= invifrags))
{
set_task(0.0,"glowinvis",id)
set_task(2.5,"invis",id)
} else if(kTeam == 2 && (get_user_frags(id) < invifrags)) {
client_print(id, print_chat, "*You need at least %i kills", invifrags)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
//VISIBILITY
public visible(id) {
new kTeam = get_user_team(id)
if(kTeam == 2 && (get_user_frags(id) >= invifrags))
{
set_task(0.0,"glowvis",id)
set_task(2.5,"vis",id)
return PLUGIN_HANDLED
} else {
client_print(id, print_chat, "*You need at least %i kills", invifrags)
return PLUGIN_HANDLED
}
return PLUGIN_HANDLED
}
//INVISIBILITY
public invis(id) {
set_user_rendering(id, kRenderFxPulseSlow,8,8,8,kRenderTransAlpha,0)
client_print(id, print_chat, "*You are Invisible!")
return PLUGIN_HANDLED
}
//VISIBILITY
public vis(id) {
set_user_rendering(id, kRenderFxPulseSlow,0,0,0,kRenderTransAlpha,255)
client_print(id, print_chat, "*You are Visible!")
return PLUGIN_HANDLED
}
//while getting invisible
public glowinvis(id) {
set_user_rendering(id,kRenderFxStrobeFast,255,130,19,kRenderNormal,25)
client_print(id, print_chat, "**Getting invisible!")
return PLUGIN_HANDLED
}
//while getting visible
public glowvis(id) {
set_user_rendering(id,kRenderFxPulseFast,200,19,130,kRenderNormal,25)
client_print(id, print_chat, "**Getting visible!")
return PLUGIN_HANDLED
}
I have add this to both of the commands. See if the team constants are correct. Only reason it not working is because it not right constants for the teams. If you need any more help, just IM using one of my IM. I'll be working on a ATAC for NS.
Edit: ps also in NS mod get_user_team doesn't work i had to do a different way so for VS mod might has to be do the same thing.