AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   A little help, please. (https://forums.alliedmods.net/showthread.php?t=207488)

Versus1994 02-03-2013 04:50

A little help, please.
 
Hi, can someone make that this VIPmenu would jump out automaticly 10 sec after the round starts?

Here is the VIPmenu:

Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>

#define PLUGIN "HnS - VIP"
#define VERSION "2.0"
 
new bool:jaUsou[ 33 ]

public plugin_init()
{
    register_plugin( PLUGIN, VERSION, "pacheco" )
    register_logevent( "logevent_round_start", 2, "1=Round_Start" )
    register_clcmd( "say /vipmenu","cmdVipMenu" )
}

public logevent_round_start()
    arrayset( jaUsou, false, 33 );

public cmdVipMenu(id)
{
    switch ( jaUsou[id] )
    {
        case true:
        {
            client_print( id, print_center, "Tu jau naudojai VIPMENIU si rounda!" )
            return PLUGIN_CONTINUE;
        }
       
        case false:
        {
            switch ( cs_get_user_team(id) )
            {
                case CS_TEAM_CT: ctVipMenu(id);
                case CS_TEAM_T: ttVipMenu(id);
                default:
                {
                    client_print( id, print_center, "Negali naudot MENIU, jei nesi pasirinkes komandos." )
                    return PLUGIN_CONTINUE;
                }
            }
        jaUsou[id] = true;
        }
    }
    return PLUGIN_HANDLED;
}

public ttVipMenu(id)
{
    new menu = menu_create( "\r[ \yVIP - Terrorist Meniu \r]", "menu_handler" );
   
    menu_additem( menu,"Glock \d(1 kulka)","1", ADMIN_RESERVATION )
    menu_additem( menu,"Nematomumas \d(10sek)","2", ADMIN_RESERVATION )
    menu_additem( menu,"Granatos \d(He, Frost)","3", ADMIN_RESERVATION )
    menu_additem( menu,"HP ir Armoras \d(120HP, 120AP)","4", ADMIN_RESERVATION )
   
    menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
    menu_display( id, menu, 0 );
}

public ctVipMenu(id)
{
    new menu = menu_create( "\r[ \yVIP - CT Meniu \r]", "menu_handler2" );
   
    menu_additem( menu,"HP ir Armoras \d(120HP, 120AP)","1", ADMIN_RESERVATION )
    menu_additem( menu,"Frost Granata","2", ADMIN_RESERVATION )
    menu_additem( menu,"Scout \d(be kulku)","3", ADMIN_RESERVATION )

    menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
    menu_display( id, menu, 0 );
}

public menu_handler(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    new key = str_to_num(data);
   
    switch (key)
    {
        case 1:
        {
            new iWeapon = give_item( id, "weapon_glock18" )
            cs_set_weapon_ammo( iWeapon, 1 )
            client_print( id, print_chat, "Tu gavai Glocka su 1 kulka." )
        }
        case 2:
        {
            set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 15 );
            set_task( 10.0, "Remover", id )
            client_print( id, print_chat, "Tu esi nematomas 10 sek." )
        }
        case 3:
        {
            give_item( id, "weapon_hegrenade" )
            give_item( id, "weapon_smokegrenade" );
            client_print( id, print_chat, "Tu gavai HE ir Frost granatas." )
        }
        case 4:
        {
            set_user_armor(id, 120)
            set_user_health(id, 120)
            client_print( id, print_chat, "Tu gavai 120HP ir 120AP." )
        }
    }
   
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public menu_handler2(id, menu, item)
{
    if( item == MENU_EXIT )
    {
        menu_destroy(menu);
        return PLUGIN_HANDLED;
    }
   
    new data[6], iName[64];
    new access, callback;
    menu_item_getinfo(menu, item, access, data,5, iName, 63, callback);
    new key = str_to_num(data);
   
    switch (key)
    {
        case 1:
        {
            set_user_health(id, 120)
            set_user_armor(id, 120)
            client_print( id, print_chat, "Tu gavai 120HP ir 120AP." )
        }
        case 2:
        {
            give_item( id, "weapon_smokegrenade" );
            client_print( id, print_chat, "Tu gavai Frost granata." )
        }
        case 3:
        {
            new iWeapon = give_item( id, "weapon_scout" )
            cs_set_weapon_ammo( iWeapon, 0 )
            client_print( id, print_chat, "Tu gavai Scout be kulku." )
        }

    }
   
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}

public Remover(id)
{
    set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255 );
    client_print( id, print_center, "Tu ir vel matomas!" )
}

I really need it, I tried to do it myself but nothing worked.

fysiks 02-03-2013 12:47

Re: A little help, please.
 
In the round start function, set a task to execute a function that loops through all players and shows the appropriate menu to each.

Versus1994 02-04-2013 06:17

Re: A little help, please.
 
Quote:

Originally Posted by fysiks (Post 1886269)
In the round start function, set a task to execute a function that loops through all players and shows the appropriate menu to each.

Didn't get that. :? i'm not good with codes.. when I tried to do it my self I took an other vipmenu that jumps out automaticly and tried to coppy the code..:D But for you scripters I dont think that would be hard.

fysiks 02-04-2013 21:05

Re: A little help, please.
 
Nope, probably not hard for experienced scripters but since you posted in the Scripting Help section, you are writing it yourself.

The "new round function" part of my post should be obvious. Then, set_task(). Then use get_players() to loop through all the players and execute the menu's on players:

PHP Code:

            switch ( cs_get_user_team(id) )
            {
                case 
CS_TEAM_CTctVipMenu(id);
                case 
CS_TEAM_TttVipMenu(id);
            } 


ConnorMcLeod 02-06-2013 00:45

Re: A little help, please.
 
@Versus1994
Read rules : https://forums.alliedmods.net/misc.php?do=showrules

Quote:

Use descriptive topic titles. People should know at a glance of the title what the thread is about.

Please change your topic title before you post again.

Versus1994 02-06-2013 08:13

Re: A little help, please.
 
Quote:

Originally Posted by ConnorMcLeod (Post 1888207)
@Versus1994
Read rules : https://forums.alliedmods.net/misc.php?do=showrules




Please change your topic title before you post again.

okay, sorry.

Quote:

Nope, probably not hard for experienced scripters but since you posted in the Scripting Help section, you are writing it yourself.

The "new round function" part of my post should be obvious. Then, set_task(). Then use get_players() to loop through all the players and execute the menu's on players:

PHP Code:
switch ( cs_get_user_team(id) )
{
case
CS_TEAM_CT: ctVipMenu(id);
case
CS_TEAM_T: ttVipMenu(id);
}

Swisa helped me, I wouldnt made it myself. :roll:

ConnorMcLeod 02-06-2013 11:43

Re: A little help, please.
 
Closed, you haven't changed title.


All times are GMT -4. The time now is 20:34.

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