Raised This Month: $ Target: $400
 0% 

I need some help to get just a function of a plugin!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
detonax
Junior Member
Join Date: May 2011
Old 02-17-2013 , 11:13   I need some help to get just a function of a plugin!
Reply With Quote #1

As the title already says it all,
I was wanting to get the function /mic aki this plugin and put it in a separate plugin containing so he

https://forums.alliedmods.net/showthread.php?t=164224

I appreciate everyone's attention, and comprehension of all!
detonax is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 02-17-2013 , 20:11   Re: I need some help to get just a function of a plugin!
Reply With Quote #2

Okay, so what is your scripting question? Are you having issues doing it yourself? Care to show us your attempt and the errors with it?
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
detonax
Junior Member
Join Date: May 2011
Old 02-17-2013 , 20:35   Re: I need some help to get just a function of a plugin!
Reply With Quote #3

Sorry I forgot to post my attempt!

Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <fun>
#include <cstrike>
#include <hamsandwich>
#include <engine>
#include <nvault>
#include <xs>
#include <dhudmessage>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Teste"

#define ADMIN_MIC         ADMIN_MENU
#define get_bit(%1,%2)         (%1 & 1<<(%2&31))
#define set_bit(%1,%2)         %1 |= (1<<(%2&31))
#define clear_bit(%1,%2)    %1 &= ~(1<<(%2&31))

#define get_bit2(%1,%2)     (%1 & 0<<(%2&31))
#define set_bit2(%1,%2)         %1 |= (0<<(%2&31))
#define clear_bit2(%1,%2)    %1 &= ~(0<<(%2&31))
#define SPEAK_TEAM  4

new g_iSpeakFlags[33];
new g_bIsConnected;        // Are we connected?
new iPage;

new const g_iSpeakNames[][] = {
    "",
    "Normal Talk", 
    "All Talk",
    "Muted", 
    "Team Talk"
};

new const SayClientCmds[][64] = {
    "duelo", "ClCmd_LastRequest", "spray",   "CmdSprayMessage", "status", "status", "box", "ClCmd_boxmatch", "boxmatch", "ClCmd_boxmatch",
    "dia", "specialday_check", "dias", "specialday_check", "voteday", "CheckStartVote", "endday", "specialday_ends",
    "glow", "JBGlowMenu", "freeday", "JBGlowMenu", "unglow", "JBUnglowMenu", 
    "classe", "ClassMenu", "shop", "ClCmd_shop", "pontos", "ClCmd_points", "ponto", "ClCmd_points", "simon", "ClCmd_simon",
    "talkchannel", "ClCmd_channel", "talk", "ClCmd_channel", "channel", "ClCmd_channel", "mic", "ClCmd_channel",
    "close", "ClCmd_closedoors", "closedoors", "ClCmd_closedoors", "open", "ClCmd_opendoors", "opendoors", "ClCmd_opendoors",
    "random", "ClCmd_randomct", "next", "ClCmd_nextproblem", "rtd", "CmdRockTheDay", "rocktheday", "CmdRockTheDay", "brincadeira", "CmdFreeForAll", "freeforall", "CmdFreeForAll",
    "hide", "ClCmd_HideTag"
};


public plugin_init() 
{
    register_dictionary("jailbreakmod1.txt");
//    register_clcmd("say /mic", "ClCmd_channel", 0)
    for(new i = 0; i < sizeof(SayClientCmds); i = i+2)
        rd_register_saycmd(SayClientCmds[i], SayClientCmds[i+1], 0);
    register_forward(FM_Voice_SetClientListening, "Fwd_SetVoice");
    
}

public ClCmd_channel(id)
{
    if(!get_bit(g_bIsConnected, id))
        return PLUGIN_HANDLED;
        
    ChatColor(id, "%L", LANG_SERVER, "JB_DAY_M112", '^3',  g_iSpeakNames[ fm_get_speak(id) ] );
    /*
    if (get_user_team(id) != 2 && !access(id, ADMIN_MIC))
    {
        fnColorPrint(id, "%L", LANG_SERVER, "JB_DAY_M105");
        return PLUGIN_HANDLED;
    }
    if(!access(id, ADMIN_MIC))
    {
        fnColorPrint(id, "%L", LANG_SERVER, "JB_NOACCESS");
        return PLUGIN_HANDLED;
    }*/
    Show_MicMenu(id, iPage);
    return PLUGIN_HANDLED;
}

public Show_MicMenu(id, iPage) { 
    if(!get_bit(g_bIsConnected, id)) 
        return PLUGIN_HANDLED;
    
    new szText[256];
    formatex(szText, charsmax(szText), "%L", LANG_SERVER, "JB_MIC_TITLE");
    new menu = menu_create(szText, "sub_channelmenu");
    
    new players[32], pnum, tempid; 
    new szName[32], szTempid[10];
    new szOption[128];
    get_players(players, pnum); 
    
    for( new i; i<pnum; i++ ) { 
        tempid = players[i]; 
        fm_get_speak(tempid);
        get_user_name(tempid, szName, charsmax(szName)); 
        num_to_str(tempid, szTempid, 9);
        formatex(szOption, 127, "%L", LANG_SERVER, "JB_MIC_M1", szName, g_iSpeakNames[ fm_get_speak(tempid) ] );
        menu_additem(menu, szOption, szTempid);
    } 
    
    menu_display(id, menu, iPage); 
    return PLUGIN_HANDLED; 
}

public sub_channelmenu(id, menu, item) { 
    if(!get_bit(g_bIsConnected, id)) 
        return PLUGIN_HANDLED;
    if( item == MENU_EXIT ) { 
        menu_destroy(menu); 
        return PLUGIN_HANDLED; 
    }
    
    if (get_user_team(id) != 2 && !access(id, ADMIN_MIC))
    {
        ChatColor(id, "%L", LANG_SERVER, "JB_DAY_M105");
        return PLUGIN_HANDLED;
    }
    if(!access(id, ADMIN_MIC))
    {
        ChatColor(id, "%L", LANG_SERVER, "JB_NOACCESS");
        return PLUGIN_HANDLED;
    }
    
    new data[6], name[64]; 
    new access, callback; 
    menu_item_getinfo(menu, item, access, data, charsmax(data), name, charsmax(name), callback); 
    
    new tempid = str_to_num(data); 
    
    new szName[32], szName2[32]; 
    get_user_name(id, szName, charsmax(szName)); 
    get_user_name(tempid, szName2, charsmax(szName2));
    
    switch( fm_get_speak(tempid) )
    {
        case 1: fm_set_speak(tempid, 2);
        case 2: fm_set_speak(tempid, 3);
        case 3: fm_set_speak(tempid, 4);
        case 4: fm_set_speak(tempid, 1);
    }

    if( id != tempid )
        ChatColor(tempid, "%L", LANG_SERVER, "JB_DAY_M113", '^3', szName, '^1', '^4', g_iSpeakNames[ fm_get_speak(tempid) ], '^1');

    player_menu_info(id, menu, menu, iPage); 
    Show_MicMenu(id, iPage);
    return PLUGIN_HANDLED; 
} 

public fm_get_speak(id)
{
    if(!get_bit(g_bIsConnected, id))
    {
        log_error(AMX_ERR_NATIVE, "[FmSetSpeak] Invalid player %d", id);
        return 0;
    }
    
    return g_iSpeakFlags[id];
}

public fm_set_speak(id, nums)
{
    if(!get_bit(g_bIsConnected, id))
    {
        log_error(AMX_ERR_NATIVE, "[FmSetSpeak] Invalid player %d", id);
        return;
    }
    g_iSpeakFlags[id] = nums;
}

public Fwd_SetVoice(const receiver, const sender, bool:bListen)
{
    if(!get_bit(g_bIsConnected, receiver) 
    || !get_bit(g_bIsConnected, sender) 
    || g_iSpeakFlags[sender] == SPEAK_NORMAL 
    && g_iSpeakFlags[receiver] != SPEAK_LISTENALL)
    {
        return FMRES_IGNORED;
    }
    
    static iSpeakType;
    iSpeakType = 0;
    if(g_iSpeakFlags[sender] == SPEAK_ALL
    || g_iSpeakFlags[receiver] == SPEAK_LISTENALL
    || g_iSpeakFlags[sender] == SPEAK_TEAM && get_pdata_int(sender, 114) == get_pdata_int(receiver, 114))
    {
        iSpeakType = 1;
    }
    
    engfunc(EngFunc_SetClientListening, receiver, sender, iSpeakType);
    return FMRES_SUPERCEDE;
}

enum Commands
{
    say,
    say_slash,
    say_dot,
    sayteam,
    sayteam_slash,
    sayteam_dot
};
    
new const say_commands[Commands][] = {
    "say /%s",
    "say %s",
    "say .%s",
    "say_team %s",
    "say_team /%s",
    "say_team .%s"
};

stock rd_register_saycmd(const saycommand[], const function[], flags) {
    static temp[64];
    for (new Commands:i = say; i < Commands; i++)
    {
        formatex(temp, 63, say_commands[i], saycommand);
        register_clcmd(temp, function, flags);
    }
}


stock ChatColor(const id, const input[], any:...)
{
    new count = 1, players[32];
    static msg[191];
    vformat(msg, 190, input, 3);
    
    replace_all(msg, 190, "!g", "^4"); // Green Color
    replace_all(msg, 190, "!y", "^1"); // Default Color
    replace_all(msg, 190, "!t", "^3"); // Team Color
    
    if (id) players[0] = id;
    else get_players(players, count, "ch");
    {
        for (new i = 0; i < count; i++)
        {
            if (is_user_connected(players[i]))
            {
                message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
                write_byte(players[i]);
                write_string(msg);
                message_end();
            }
        }
    }
}
the menu does not open, do not know why.
detonax is offline
Reply



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 21:45.


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