AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   VIPmenu jump out. HELP please :/ (https://forums.alliedmods.net/showthread.php?t=241550)

Versus1994 06-05-2014 12:23

VIPmenu jump out. HELP please :/
 
Hey guys!
I need some help with making this VIPMENU jump out automaticly after 10 seconds when every round beginins only for VIPS. ( 10 seconds after the round starts! )
I really need this :// Could someone help?
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, "You have already used the menu this round." )
            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, "You can't use the menu if you haven't chosen a team" )
                    return PLUGIN_CONTINUE;
                }
            }
        jaUsou[id] = true;
        }
    }
    return PLUGIN_HANDLED;
}
 
public ttVipMenu(id)
{
    new menu = menu_create( "\r[ \yHNS VIP - Terrorist Menu \r]", "menu_handler" );
 
    menu_additem( menu,"USP \d(2 bullets)","1", ADMIN_RESERVATION )
    menu_additem( menu,"Invisibility \d(10sec)","2", ADMIN_RESERVATION )
    menu_additem( menu,"Granades \d(He,Sg,2xF)","3", ADMIN_RESERVATION )
    menu_additem( menu,"120HP 120 AP","4", ADMIN_RESERVATION )
 
    menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
    menu_display( id, menu, 0 );
}
 
public ctVipMenu(id)
{
    new menu = menu_create( "\r[ \yHNS VIP - CT Menu \r]", "menu_handler2" );
 
    menu_additem( menu,"USP \d(1 bullets)","1", ADMIN_RESERVATION )
    menu_additem( menu,"Granade Smoke","2", ADMIN_RESERVATION )
    menu_additem( menu,"120HP 120 AP","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_usp" )
            cs_set_weapon_ammo( iWeapon, 2 )
            client_print( id, print_chat, "You selected: Item one" )
        }
        case 2:
        {
            set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 15 );
            set_task( 10.0, "Remover", id )
            client_print( id, print_chat, "You selected: Item two" )
        }
        case 3:
        {
            give_item( id, "weapon_hegrenade" )
            give_item( id, "weapon_flashbang" )
            give_item( id, "weapon_flashbang" )
            give_item( id, "weapon_smokegrenade" );
            client_print( id, print_chat, "You selected: Item three" )
        }
        case 4:
        {
            set_user_armor(id, 120)
            set_user_health(id, 120)
            client_print( id, print_chat, "You selected: Item four" )
        }
    }
 
    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:
        {
            new iWeapon = give_item( id, "weapon_usp" )
            cs_set_weapon_ammo( iWeapon, 1 )
            client_print( id, print_chat, "You selected: Item one" )
        }
        case 2:
        {
            give_item( id, "weapon_smokegrenade" );
            client_print( id, print_chat, "You selected: Item two" )
        }
        case 3:
        {
            set_user_armor(id, 120)
            set_user_health(id, 120)
            client_print( id, print_chat, "You selected: Item three" )
        }
    }
 
    menu_destroy(menu);
    return PLUGIN_HANDLED;
}
 
public Remover(id)
{
    set_user_rendering( id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, 255 );
    client_print( id, print_center, "You're visible now." )
}


Flick3rR 06-05-2014 12:33

Re: VIPmenu jump out. HELP please :/
 
This is scripting help section, so I guess you will understand. You must use Ham_Spawn and set task, when to display the menu, etc. You can also use new round event, because the previous method will cal the menu on every spawn. If you want just on new round, hook new round event, loop trough all the players, and then set the task, when to display the mwnu. Aand don't forget the check for flags, when you set the task. Think that's all.

Versus1994 06-05-2014 12:37

Re: VIPmenu jump out. HELP please :/
 
Flick3rR - I know this is the help section but I dont honestly dont know how to do it. If there would be some else section I would post it there.. :/ Now I'm just hoping someone will make that code for me. ://

Versus1994 06-05-2014 12:41

Re: VIPmenu jump out. HELP please :/
 
I tried this: set_task(10.0, "call_VipMenu", id+TASK_VIP)
I found it on another plugin but I get alot of errors when compiling

Flick3rR 06-05-2014 12:42

Re: VIPmenu jump out. HELP please :/
 
It's easy one, so I guess someone will make it soon. But it would be better a moderator to move it to the Suggestions / Requests section, where is the place of the thread.

Versus1994 06-05-2014 12:44

Re: VIPmenu jump out. HELP please :/
 
Oh, I will know next time.


All times are GMT -4. The time now is 09:42.

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