Raised This Month: $51 Target: $400
 12% 

[CS:GO] Respawn Players Menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:50.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode