Hey guys, i'm trying to make a !vipmenu option, where a vip player can select a weapon for the round.
i have this code :
Code:
#define PLUGIN_AUTHOR "d22tny"
#define PLUGIN_VERSION "1.0.0"
#include <sourcemod>
#include <sdktools>
#include <colors>
int round;
bool isNotUsed;
public Plugin myinfo =
{
name = "VIP Menu",
author = PLUGIN_AUTHOR,
version = PLUGIN_VERSION,
description = "weapons for vip",
url = "www.laleagane.ro"
};
public void OnPluginStart()
{
HookEvent("round_start", roundstart);
RegAdminCmd("sm_vipmenu", arme, ADMFLAG_CUSTOM1, "Comanda pentru arme VIP");
}
public void OnMapStart()
{
round = 0;
}
public Action roundstart(Handle event, const char[] name, bool dontBroadcast){
round++;
isNotUsed = true;
}
public Action arme(int client, int args)
{
Menu vipmenu = new Menu(VIPMenu_Handler, MENU_ACTIONS_ALL);
vipmenu.SetTitle("Meniu Arme");
vipmenu.AddItem("AK47", "AK47");
vipmenu.AddItem("M4A4", "M4A4");
vipmenu.AddItem("M4A1-S", "M4A1-S");
vipmenu.AddItem("AWP", "AWP");
vipmenu.ExitButton = true;
vipmenu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
public int VIPMenu_Handler(Menu vipmenu, MenuAction action, int param1, int param2)
{
char choice[32];
vipmenu.GetItem(param2, choice, sizeof(choice));
if (action == MenuAction_Select)
{
if (StrEqual(choice, "AK47"))
{
if(round!=1 && round!= 17 && round!=2 && isNotUsed){
GivePlayerItem(param1, "weapon_ak47");
CPrintToChat(param1, "{blue}[Nordic] {red}Ai ales {purple}AK47 {green}!");
isNotUsed = false;
} else {
CPrintToChat(param1, "{blue}[Nordic] {red}Nu poti lua arma {purple}{green}!");
}
}
else if (StrEqual(choice, "M4A4"))
{
if(round!=1 && round!= 17 && round!=2 && isNotUsed){
GivePlayerItem(param1, "weapon_m4a4");
CPrintToChat(param1, "{blue}[Nordic] {red}Ai ales {purple}M4A4 {green}!");
isNotUsed = false;
} else {
CPrintToChat(param1, "{blue}[Nordic] {red}Nu poti lua arma {purple}{green}!");
}
}
else if (StrEqual(choice, "M4A1-S"))
{
if(round!=1 && round!= 17 && round!=2 && isNotUsed){
GivePlayerItem(param1, "weapon_m4a1_silencer");
CPrintToChat(param1, "{blue}[Nordic] {red}Ai ales {purple}M4A1 {green}!");
isNotUsed = false;
} else {
CPrintToChat(param1, "{blue}[Nordic] {red}Nu poti lua arma {purple}{green}!");
}
}
else if (StrEqual(choice, "AWP"))
{
if(round!=1 && round!= 17 && round!=2 && isNotUsed){
GivePlayerItem(param1, "weapon_AWP");
CPrintToChat(param1, "{blue}[Nordic] {red}Ai ales {purple}AWP {green}!");
isNotUsed = false;
}
else
{
CPrintToChat(param1, "{blue}[Nordic] {red}Nu poti lua arma {purple}{green}!");
}
}
}
else if (action == MenuAction_End)
{
delete vipmenu;
}
}
it works, but CPrintToChat does nothing, i get the weapon when using the menu but nothing appears in chat.
and also.. my way of making it usable once per round it's not working.. any ideas ??