Raised This Month: $32 Target: $400
 8% 

Solved [CS:GO] Request plugin move player ...


Post New Thread Reply   
 
Thread Tools Display Modes
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-23-2018 , 06:24   Re: [CS:GO] Request plugin move player ...
Reply With Quote #11

@Klaus
There's already a function called AddTargetsToMenu xd, saves up some lines ^^

@Mohammed
PHP Code:
if (action == MenuAction_Select
{
    
ClientCommand(client"sm_move");

mug1wara is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 06-23-2018 , 14:12   Re: [CS:GO] Request plugin move player ...
Reply With Quote #12

Quote:
Originally Posted by mug1wara View Post
@Klaus
There's already a function called AddTargetsToMenu xd, saves up some lines ^^

@Mohammed
PHP Code:
if (action == MenuAction_Select
{
    
ClientCommand(client"sm_move");

There is no other way ??
Dr.Mohammad is offline
KlausLaw
AlliedModders Donor
Join Date: Feb 2018
Location: Israel
Old 06-23-2018 , 14:45   Re: [CS:GO] Request plugin move player ...
Reply With Quote #13

PHP Code:
#define PLUGIN_AUTHOR "Klaus"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>



public Plugin myinfo 
{
    
name "MoveTeam"
    
author PLUGIN_AUTHOR
    
description "Allows admins to change players team"
    
version PLUGIN_VERSION
    
url "https://steamcommunity.com/id/KlausLaw/"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_move"SM_MoveADMFLAG_BAN);
}

public 
Action SM_Move(int clientint args)
{
    
openPlayersMenu(client);
    return 
Plugin_Handled;
}

void openPlayersMenu(int client)
{
    
Menu menu = new Menu(Menu_PlayersList);
    
menu.SetTitle("[MoveTeam] - Select a player\n \n");
    
char sInfo[12], sName[MAX_NAME_LENGTH];
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i))continue;
        
IntToString(isInfosizeof(sInfo));
        
GetClientName(isNamesizeof(sName));
        
menu.AddItem(sInfosName);
    }
    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
int Menu_PlayersList(Menu menuMenuAction actionint clientint Position)
{
    if (
action == MenuAction_Select)
    {
        
char item[12];
        
menu.GetItem(Positionitemsizeof(item));
        
int target StringToInt(item);
        
char sInfo[24];
        
Menu moveMenu = new Menu(Menu_MoveMenu);
        
moveMenu.SetTitle("[MoveTeam] - Select a team\n \n");
        
Format(sInfosizeof(sInfo), "%d-3"target);
        
moveMenu.AddItem(sInfo"CT Team");
        
Format(sInfosizeof(sInfo), "%d-2"target);
        
moveMenu.AddItem(sInfo"T Team");
        
Format(sInfosizeof(sInfo), "%d-1"target);
        
moveMenu.AddItem(sInfo"Spec Team");
        
moveMenu.Display(clientMENU_TIME_FOREVER);
        
    }
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
int Menu_MoveMenu(Menu menuMenuAction actionint clientint Position)
{
    if (
action == MenuAction_Select)
    {
        
char infoExploded[2][12];
        
char item[24];
        
menu.GetItem(Positionitemsizeof(item));
        
ExplodeString(item"-"infoExplodedsizeof(infoExploded), sizeof(infoExploded[]));
        
int target StringToInt(infoExploded[0]);
        
int team StringToInt(infoExploded[1]);
        
ChangeClientTeam(targetteam);
    }
    if (
action == MenuAction_Cancel)
    {
        
openPlayersMenu(client);
    }
    if (
action == MenuAction_End)
    {
        
delete menu;
    }

Here you go, if you hit exit on the "Select a team" menu, you will be redirected to the main menu.
__________________
Taking private requests

KlausLaw is offline
Dr.Mohammad
Senior Member
Join Date: Jan 2016
Location: CSGO Servers
Old 06-23-2018 , 16:22   Re: [CS:GO] Request plugin move player ...
Reply With Quote #14

Quote:
Originally Posted by KlausLaw View Post
PHP Code:
#define PLUGIN_AUTHOR "Klaus"
#define PLUGIN_VERSION "1.00"

#include <sourcemod>
#include <sdktools>
#include <cstrike>
#include <sdkhooks>



public Plugin myinfo 
{
    
name "MoveTeam"
    
author PLUGIN_AUTHOR
    
description "Allows admins to change players team"
    
version PLUGIN_VERSION
    
url "https://steamcommunity.com/id/KlausLaw/"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_move"SM_MoveADMFLAG_BAN);
}

public 
Action SM_Move(int clientint args)
{
    
openPlayersMenu(client);
    return 
Plugin_Handled;
}

void openPlayersMenu(int client)
{
    
Menu menu = new Menu(Menu_PlayersList);
    
menu.SetTitle("[MoveTeam] - Select a player\n \n");
    
char sInfo[12], sName[MAX_NAME_LENGTH];
    for (
int i 1<= MaxClientsi++)
    {
        if (!
IsClientInGame(i))continue;
        
IntToString(isInfosizeof(sInfo));
        
GetClientName(isNamesizeof(sName));
        
menu.AddItem(sInfosName);
    }
    
menu.Display(clientMENU_TIME_FOREVER);
}

public 
int Menu_PlayersList(Menu menuMenuAction actionint clientint Position)
{
    if (
action == MenuAction_Select)
    {
        
char item[12];
        
menu.GetItem(Positionitemsizeof(item));
        
int target StringToInt(item);
        
char sInfo[24];
        
Menu moveMenu = new Menu(Menu_MoveMenu);
        
moveMenu.SetTitle("[MoveTeam] - Select a team\n \n");
        
Format(sInfosizeof(sInfo), "%d-3"target);
        
moveMenu.AddItem(sInfo"CT Team");
        
Format(sInfosizeof(sInfo), "%d-2"target);
        
moveMenu.AddItem(sInfo"T Team");
        
Format(sInfosizeof(sInfo), "%d-1"target);
        
moveMenu.AddItem(sInfo"Spec Team");
        
moveMenu.Display(clientMENU_TIME_FOREVER);
        
    }
    if (
action == MenuAction_End)
    {
        
delete menu;
    }
}

public 
int Menu_MoveMenu(Menu menuMenuAction actionint clientint Position)
{
    if (
action == MenuAction_Select)
    {
        
char infoExploded[2][12];
        
char item[24];
        
menu.GetItem(Positionitemsizeof(item));
        
ExplodeString(item"-"infoExplodedsizeof(infoExploded), sizeof(infoExploded[]));
        
int target StringToInt(infoExploded[0]);
        
int team StringToInt(infoExploded[1]);
        
ChangeClientTeam(targetteam);
    }
    if (
action == MenuAction_Cancel)
    {
        
openPlayersMenu(client);
    }
    if (
action == MenuAction_End)
    {
        
delete menu;
    }

Here you go, if you hit exit on the "Select a team" menu, you will be redirected to the main menu.
nice. thnak you guys for help me :XX
Dr.Mohammad is offline
Reply


Thread Tools
Display Modes

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 15:22.


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