Raised This Month: $ Target: $400
 0% 

CT Menu(add code)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bloods
Member
Join Date: Aug 2013
Old 05-09-2014 , 20:18   CT Menu(add code)
Reply With Quote #1

Hey, I want to know if someone can add code from an open cells plugin(Here) and then add it to my current plugin (Here). Add the cells plugin in the open cells code part on the plugin. Thanks for the help.
Bloods is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 05-10-2014 , 11:22   Re: CT Menu(add code)
Reply With Quote #2

Here:

PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <fun>

#define PLUGIN "JB CT Menu"
#define VERSION "1.0"
#define AUTHOR "MiX"

#define COLOR_OFF -1
#define COLOR_RED 0
#define COLOR_BLUE 1
#define COLOR_GREEN 2
#define COLOR_LAST 2

new found[10];

new const 
MSG_PREFIX[] = "|Fn|"// Defines the Message Prefix
new g_iSelectedColor[33], g_sayText;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
register_clcmd("say /ctmenu""clcmd_say_ctmenu"_"- Opens a menu for CTs");
    
register_logevent("logevent_roundstart"2"1=Round_Start");
    
g_sayText get_user_msgid("SayText");
}

// Unglow all Terrorists on round start
public logevent_roundstart()
{
    static 
i;
    for (
033; ++i)
        if (
is_user_alive(i))
            
set_user_rendering(ikRenderFxGlowShell000);    
}

srv_message(id, const message[], any:...)
{
    static 
szMessage[192];
    static const 
MSG_PREFIX_LENGTH = (sizeof(MSG_PREFIX) + 3);
    
formatex(szMessageMSG_PREFIX_LENGTH"^x04%s^x01 "MSG_PREFIX);
    
vformat(szMessage[MSG_PREFIX_LENGTH], 191 MSG_PREFIX_LENGTHmessage3);

    if (!
id) {
        
message_begin(MSG_BROADCASTg_sayText_, -1);
        
write_byte(-1);
    } else {
        
message_begin(MSG_ONE_UNRELIABLEg_sayText_id);
        
write_byte(id);
    }
    
write_string(szMessage);
    
message_end();
}

// A player said /ctmenu in chat
public clcmd_say_ctmenu(id)
{
    
// Check if user is an alive CT, else print an error message
    
if (cs_get_user_team(id) != CS_TEAM_CT || !is_user_alive(id)) {
        
srv_message(id"You cannot open this menu as it's for alive CTs only.");
        return 
PLUGIN_HANDLED;
    }
    new 
menu menu_create("CT Menu""menu_handle_ct");
    
menu_additem(menu"Glow Players");
    
menu_additem(menu"Glow into 50/50");
    
menu_additem(menu"\dOpen Cells");
    
menu_additem(menu"\dStart a Funday");
    
menu_display(idmenu);
    return 
PLUGIN_HANDLED;
}

// Handles the option chosen in the CT Menu
public menu_handle_ct(idmenuitem)
{
    switch (
item) {
        case 
0: {
            
menu_destroy(menu);
            
g_iSelectedColor[id] = 0// Set the first color option to the default color
            
menu_display(idmenu_create_glow(id));
        }
        case 
1: {
            
menu_destroy(menu);
            
glow_terrors_random(id);
        }
        case 
2: {
            
menu_destroy(menu);
            
Push_Button()
        }
        case 
3: {
            
menu_destroy(menu);
            
srv_message(id"Functionality not yet implemented");
        }
        default: 
// On exit
            
menu_destroy(menu);
    }
    return 
PLUGIN_HANDLED;
}

// Creates and returns the menu for glowing Terrorists
public menu_create_glow(id)
{
    static 
iiTerrors[32], iTerrorsNumiItemCountszColorItem[17], szTempName[34], szMenuInfo[1];
    static 
iTempId;

    
// The currently selected color
    
switch (g_iSelectedColor[id]) {
        case 
COLOR_RED:
            
copy(szColorItem16"\yColor: \wRed");
        case 
COLOR_BLUE:
            
copy(szColorItem16"\yColor: \wBlue");
        case 
COLOR_GREEN:
            
copy(szColorItem16"\yColor: \wGreen");
        default:
            
copy(szColorItem16"\yColor: \wOff");
    }

    new 
menu menu_create("CT Menu - Glow""menu_handle_glow");
    
menu_additem(menu"\yUnglow all", {-1});

    
get_players(iTerrorsiTerrorsNum"e""TERRORIST");
    
iItemCount 1// The amount of items on the current page
    
for (0iTerrorsNumi++) {
        
iItemCount++;
        if (
iItemCount 6) {
            
// The 7th item is the color chooser; 8 and 9 are previous and next page
            
menu_additem(menuszColorItem, {0});
            
iItemCount 0;
        }
        
iTempId iTerrors[i];
        
szMenuInfo[0] = iTempId// Store the ID in the info
        
if (is_user_alive(iTempId)) {
            
get_user_name(iTempIdszTempName33);
        } else {
            
copy(szTempName2"\d");
            
get_user_name(iTempIdszTempName[2], 31);
        }
        
menu_additem(menuszTempNameszMenuInfo);
    }
    
menu_additem(menuszColorItem, {0}); // The last item is always the color chooser

    
return menu;
}

// Handles the option chosen in the Glow menu
public menu_handle_glow(idmenuitem)
{
    if (
item == MENU_EXIT) {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    
// Get the selected item from the info
    
static szMenuInfo[1], iTargetiAccessiCallbackiPage;
    
menu_item_getinfo(menuitemiAccessszMenuInfo1__iCallback);
    
iTarget szMenuInfo[0];

    
// Check which item was selected
    
switch (iTarget) {
        case -
1: { // Unglow all
            
static iiTerrors[32], iTerrorsNumszName[32];
            
get_players(iTerrorsiTerrorsNum"ae""TERRORIST");
            for (
0iTerrorsNumi++)
                
set_user_rendering(iTerrors[i], kRenderFxGlowShell000);    

            
// Announce in chat
            
get_user_name(idszName31);
            
srv_message(0"%s has split the prisoners into two teams."szName);
        }
        case 
0: { // Change color
            
if (g_iSelectedColor[id] >= COLOR_LAST)
                
g_iSelectedColor[id] = COLOR_OFF;
            else
                
g_iSelectedColor[id]++;
        }
        default: { 
// Glow a player
            
if (is_user_alive(iTarget)) { // Disregard dead players
                
static iColor[3], szColor[6//szName[32], szTarg[32];

                // The selected color
                
switch (g_iSelectedColor[id]) {
                    case 
COLOR_RED:{
                        
iColor = {25500};
                        
copy(szColor5"red");
                    }
                    case 
COLOR_BLUE: {
                        
iColor = {00255};
                        
copy(szColor5"blue");
                    }
                    case 
COLOR_GREEN: {
                        
iColor = {02550};
                        
copy(szColor5"green");
                    }
                    default: 
iColor = {000};
                }
                
set_user_rendering(iTargetkRenderFxGlowShelliColor[0], iColor[1], iColor[2]);
            }
        }
    }
    
menu_destroy(menu);
    
iPage = (item 7); // 7 items per page (previous/next page and exit do not count as items)
    
menu_display(idmenu_create_glow(id), iPage);
    return 
PLUGIN_HANDLED;
}

// Divide all alive Terrorists into two Teams and glows them accordingly
public glow_terrors_random(id)
{
    static 
iiTerrors[32], iTerrorsNumiTeamMaxiTeamANumiTeamBNumiTeamA[16], iTeamB[16];
    
get_players(iTerrorsiTerrorsNum"ae""TERRORIST");

    
iTeamMax = (iTerrorsNum 2);
    
iTeamANum 0;
    
iTeamBNum 0;
    for (
0iTerrorsNumi++) {
        if (
iTeamANum iTeamMax) { // Check if Team A isn't full yet
            // Check if Team B isn't full yet, then randomly decide
            
if ((iTeamBNum iTeamMax) && random(2)) {
                
iTeamB[iTeamBNum] = iTerrors[i];
                
iTeamBNum++;
            } else { 
// Fill Team A with (remaining) Players
                
iTeamA[iTeamANum] = iTerrors[i];
                
iTeamANum++;
            }
        } else { 
// Fill Team B with remaining Players
            
iTeamB[iTeamBNum] = iTerrors[i];
            
iTeamBNum++;
        }
    }
    for (
0iTeamANumi++)
        
set_user_rendering(iTeamA[i], kRenderFxGlowShell25500);

    for (
0iTeamBNumi++)
        
set_user_rendering(iTeamB[i], kRenderFxGlowShell00255);

    
// Announce in chat
    
static szName[32];
    
get_user_name(idszName31);
    
srv_message(0"%s has randomly divided the Terrorists into two Teams."szName);
}

public 
Push_Button()

        new 
ent 
        
new ent3 
        
new Float:origin[3
        new 
Float:radius 200.0 
        
new class[32
        new 
name[32]
        new 
pos 
        
while((pos <= sizeof(found)) && (ent engfunc(EngFunc_FindEntityByStringent"classname""info_player_deathmatch")))
        { 
                new 
ent2 
                pev
(entpev_originorigin
                while((
ent2 engfunc(EngFunc_FindEntityInSphereent2originradius)))
                { 
                        if(!
pev_valid(ent2)) 
                                continue 

                        
pev(ent2pev_classname, class, charsmax(class)) 
                        if(!
equal(class, "func_door")) 
                                continue 

                        
pev(ent2pev_targetnamenamecharsmax(name)) 
                        
ent3 engfunc(EngFunc_FindEntityByString0"target"name)
                        if(
pev_valid(ent3) && (in_array(ent3foundsizeof(found)) < 0)) 
                        { 
                                
ExecuteHamB(Ham_Useent30011.0)
                                
found[pos] = ent3 
                                pos
++
                                break
                        } 
                } 
        } 
        return 
pos 


stock in_array(needledata[], size

        for(new 
0sizei++) 
        { 
                if(
data[i] == needle
                        return 

        

        return -


__________________
Like my clean plugins and work?
Baws is offline
Bloods
Member
Join Date: Aug 2013
Old 05-10-2014 , 14:24   Re: CT Menu(add code)
Reply With Quote #3

Thanks!
Bloods is offline
Baws
Veteran Member
Join Date: Oct 2012
Old 05-10-2014 , 16:03   Re: CT Menu(add code)
Reply With Quote #4

No problem.
__________________
Like my clean plugins and work?
Baws 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 09:35.


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