View Single Post
Author Message
andrept4
Senior Member
Join Date: Dec 2012
Location: Portugal
Old 07-13-2018 , 08:22   [CS:GO] Respawn Players Menu
Reply With Quote #1

Hello guys, I made a plugin that creates a menu for admins that respawns players, I can't really test it so I would like to take advantage of your knowledge to tell me if you think that it works or even test it, thank you anyway

Code:
#include <sourcemod>
#include <cstrike>
#include <sdktools>
#include <menus>
#include <adminmenu>

public Plugin myinfo = {
  name = "[PUNT] Respawn Menu",
  author = "GelaPT",
  description = "Reviver um jogador ou enviar um jogador vivo para o spawn",
  version = "1.0",
  url = ""
}

public OnPluginStart() {
  RegAdminCmd("sm_reviver", sm_reviver, ADMFLAG_SLAY)
}

public Action sm_reviver(int client, int args) {
  openMenu(client);

  return Plugin_Handled;
}

public void openMenu(int client) {
  Menu menu = new Menu(RespawnMenuHandler, MENU_ACTIONS_ALL);

  menu.SetTitle("Reviver jogador:");
  AddTargetsToMenu(menu, 0, true, false);
  menu.ExitButton = true;
  menu.Display(client, 0);

}

public int RespawnMenuHandler(Menu menu, MenuAction action, int client, int param2) {
  switch(action) {
    case MenuAction_Start:{}
    case MenuAction_Display:
    {
      Panel panel = view_as<Panel>(param2);
      panel.SetTitle("Reviver Jogador");
    }
    case MenuAction_Select:
    {
      openMenu(client);
      char info[MAX_NAME_LENGTH];
      if(menu.GetItem(param2, info, sizeof(info))) {
        int target = GetClientOfUserId(StringToInt(info));

        CS_RespawnPlayer(target);
      }
    }
    case MenuAction_End:
    {
      delete menu;
    }
    case MenuAction_Cancel:
    {
      delete menu;
    }
    case MenuAction_DrawItem:
    {
      int style;
      char info[32];
      menu.GetItem(param2, info, sizeof(info), style);

      return style;
    }
  }

  return 0;
}
__________________

Last edited by andrept4; 07-13-2018 at 08:23.
andrept4 is offline