Raised This Month: $ Target: $400
 0% 

[HELP] with messagemode.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
ShLuMieL
Senior Member
Join Date: Jul 2010
Old 01-17-2014 , 11:18   [HELP] with messagemode.
Reply With Quote #1

Hey to all I want to make a menu that will open the players names menu and I can give point with this menu.

I create a CMD that you can give a player point's 'a_givepoints [Name] [Num]'
and I want to do messagemode to this name and then I just need to write number and it will give to this player points.
Look at this code.
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Admin Menu"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

// Points.
new gPoints[33];

// Plugin Start.
public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Clcmds.
    
register_clcmd("say /a""Menu");
    
    
// Manager Cmds.
    
register_concmd("a_givepoints""GivePoints"ADMIN_RCON"Add points to a player")
    
register_concmd("a_takepoints""TakePoints" ,ADMIN_RCON"Remove points from a player")
    
}

public 
Menu(id)
{
    new 
szItem[256]
    
    
formatex(szItemcharsmax(szItem), "Main Menu:")
    new 
menu menu_create(szItem"Menu_Handler"
    
    
menu_additem(menu"Admin Cmds."""0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
    
menu_display(idmenu0);
}

public 
Menu_Handler(idmenuitem)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    switch(
item)
    {
        case 
0AdminCmdsMenu(id)
        }
    
    return 
PLUGIN_HANDLED;
}

// Admins Cmds Menu.
public AdminCmdsMenu(id)
{
    new 
some[256], menu;
    
    static 
players[32],szTemp[10],pnum;    
    
get_players(players,pnum,"ch");
    
    
formatex(some,255,"Player's Control:");
    
    
menu menu_create(some,"AdminCmdsMenu_Handler");
    
    for (new 
ipnumi++)
    {
        
formatex(some,256,"%s"get_player_name(players[i]));
        
num_to_str(players[i],szTemp,charsmax(szTemp));
        
menu_additem(menusomeszTemp);
    }
    
    
menu_setprop(menuMPROP_EXITNAME"Back")
    
menu_setprop(menuMPROP_EXITMEXIT_ALL );
    
menu_display(idmenu);
    
    return 
PLUGIN_HANDLED;
}

public 
AdminCmdsMenu_Handler(id,menuitem){
    if (
item == MENU_EXIT)
    {
        
Menu(id);
        return 
PLUGIN_HANDLED;
    }
    
    new 
data[6];
    
    new 
player str_to_num(data);
    
    
client_cmd(id"messagemode a_givepoints ^"%s^""get_player_name(player))
    
    return 
PLUGIN_HANDLED;
}

// Manager Cmds.
public GivePoints(id) {
    if(
get_user_flags(id) & ADMIN_RCON) {
        
        new 
PlayerToGive[32], POINTS[32]
        
read_argv(1,PlayerToGive,31)
        
read_argv(2,POINTS31)
        new 
Player cmd_target(id,PlayerToGive,9)
        
        if(!
Player) {
            
            return 
PLUGIN_HANDLED
            
        
}
        
        new 
POINTStoGive str_to_num(POINTS)
        new 
MaxPoints 1000;
        
        if(
POINTStoGive <= 0) {
            
ColorChat(id,"You canno't give^3 0 ^1or ^3less ^4Points^1.");
            return 
PLUGIN_HANDLED;
        }
        
        else if(
POINTStoGive MaxPoints) {
            
ColorChat(id,"You canno't give more than ^3%i ^4Points^1."MaxPoints);
            return 
PLUGIN_HANDLED;
        }
        
        new 
name[32],owner[32]
        
get_user_name(id,owner,31)
        
get_user_name(Player,name,31)
        
ColorChat(0,"^4ADMIN^3 %s^1 give to^4 %s^3 %s ^4Points^1."owner,name,POINTS);
        
gPoints[Player] += POINTStoGive
        
    
}
    
    else {
        
        
client_print(id,print_console,"You have no acces to that command")
        
        return 
PLUGIN_HANDLED
    
}
    
    return 
PLUGIN_HANDLED;
}

public 
TakePoints(id) {
    if(
get_user_flags(id) & ADMIN_RCON) {
        
        
        new 
PlayerToTake[32], POINTS[32]
        
read_argv(1,PlayerToTake,31 )
        
read_argv(2,POINTS,31 )
        new 
Player cmd_target(id,PlayerToTake,9)
        
        if(!
Player) {
            
            return 
PLUGIN_HANDLED
            
        
}
        
        new 
POINTStoTake str_to_num(POINTS)
        
        if(
POINTStoTake gPoints[Player]) {
            
ColorChat(id,"You canno't take more ^4Points ^1that he have.");
            return 
PLUGIN_HANDLED;
        }
        
        else {
            new 
name[32],owner[32]
            
get_user_name(id,owner,31)
            
get_user_name(Player,name,31)
            
ColorChat(0,"^4ADMIN^3 %s^1 take to^4 %s^3 %s^1 Points."owner,name,POINTS);
            
gPoints[Player] -= POINTStoTake
        
}
        
    }
    
    else {
        
        
client_print(id,print_console,"You have no acces to that command.")
        
        return 
PLUGIN_HANDLED
        
    
}
    
    return 
PLUGIN_HANDLED;
}

stock get_player_name(id){
    static 
szName[32];
    
get_user_name(id,szName,31);
    return 
szName;
}

stock ColorChat(const id, const string[], {FloatSqlResul,_}:...)
{
        new 
msg[191], players[32], count 1;
       
        static 
lenlen formatex(msgcharsmax(msg), "^x04[^x01 %s^x04 ]^x01 "PLUGIN);
        
vformat(msg[len], charsmax(msg) - lenstring3);
       
        if(
id)    players[0] = id;
        else    
get_players(players,count,"ch");
       
        for (new 
0counti++)
        {
                if(
is_user_connected(players[i]))
                {
                        
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"),_players[i]);
                        
write_byte(players[i]);
                        
write_string(msg);
                        
message_end();
                }
        }

Thanks for helping.
ShLuMieL 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 10:15.


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