AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Round start pop out (https://forums.alliedmods.net/showthread.php?t=242636)

nixh 06-22-2014 10:03

Round start pop out
 
Hey, i was trying to make that this menu pops out in round start, but it only pops out to terrorist team, and for ct's they got print in chat "VipUsed" so could you help me ant fix this problem? i need that for both teams this menu appear in round start. :stupid:

PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <colorchat>

#define VIP_LEVEL ADMIN_CHAT

new const PREFIX[] = { "!g[YourTag]!n" };

new 
VipUsed[33];

public 
plugin_init()
{
        
register_plugin("VIPMenu""1.0""whocares");
        
RegisterHam(Ham_Spawn"player""player_spawn"1);
}

public 
player_spawn(id)
{
    if(!
is_user_alive(id))
        return 
HAM_IGNORED
    
if(get_user_flags(id) & ADMIN_CHAT)
    {
        
cmdVmenu(id)
    }
    return 
HAM_IGNORED
}

public 
cmdVmenu(id)
{
        if(!(
get_user_flags(id) & ADMIN_CHAT))
        {
                
client_printc(id"%s You're not VIP member."PREFIX);
                return 
PLUGIN_HANDLED;
        }
        
        if(!
VipUsed[id])
        {
                switch(
cs_get_user_team(id))
                {
                        case 
CS_TEAM_CTVipCTMenu(id);
                        case 
CS_TEAM_TVipTMenu(id);
                }
        }
        else if (
VipUsed[id])
        {
                
client_printc(id"%s Wait for next Round."PREFIX);
        }
        return 
PLUGIN_HANDLED;
}

public 
VipCTMenu(id)
{
        new 
menu menu_create("\rV\wIP \rM\wenu:""VipCTMenu_handler");

        
menu_additem(menu"\wScout no bullet""1"0);
        
menu_additem(menu"\wHE Grenade""2"0);
        
menu_additem(menu"\w+20HP""3"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
}

public 
VipCTMenu_handler(idmenuitem)
{
        if( 
item == MENU_EXIT )
        {
                
menu_destroy(menu);
                return 
PLUGIN_HANDLED;
        }

        switch(
item)
        {
                case 
0:
                {
                        
give_item(id"weapon_scout");
                        
cs_set_user_bpammo(idCSW_SCOUT0);
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_scout"id), 0);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed Scout");
                        
VipUsed[id] = true;
                }
                case 
1:
                {
                        
give_item(id"weapon_hegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed HeGrenade");
                        
VipUsed[id] = true;
                }
                case 
2:
                {
                        
set_user_health(idget_user_health(id) + 20);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed +20 Health");
                        
VipUsed[id] = true;
                }
        }

        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}

public 
VipTMenu(id)
{
        new 
menu menu_create("\rV\wIP \rM\wenu:""VipTMenu_handler");

        
menu_additem(menu"\wHE Grenade""1"0);
        
menu_additem(menu"\GGlock 2 bullets""2"0);
        
menu_additem(menu"\w2 FB""3"0);
        
menu_additem(menu"\w+30HP""4"0);
        
menu_additem(menu"\wSG Grenade""5"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
}

public 
VipTMenu_handler(idmenuitem)
{
        if( 
item == MENU_EXIT )
        {
                
menu_destroy(menu);
                return 
PLUGIN_HANDLED;
        }

        switch(
item)
        {
                case 
0:
                { 
                        
give_item(id"weapon_hegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed HeGrenade");
                        
VipUsed[id] = true;
                }
                case 
1:
                {
                        
give_item(id"weapon_glock18");
                        
cs_set_user_bpammo(idCSW_GLOCK180);
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_glock18"id), 2);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed Glock with 2 bullets");
                        
VipUsed[id] = true;
                }               
                case 
2:
                {
                        
give_item(id"weapon_flashbang");
                        
give_item(id"weapon_flashbang");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed 2 Flash grenades");
                        
VipUsed[id] = true;                     
                }  
                case 
3
                { 
                        
set_user_health(idget_user_health(id) + 30);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed +20 Health");
                        
VipUsed[id] = true;
                }
                case 
4
                { 
                        
give_item(id"weapon_smokegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed SmokeGrenade");
                        
VipUsed[id] = true;
                }
        }

        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}

stock client_printc(const id, const input[], any:...)
{
        new 
count 1players[32];
        static 
msg[191];
        
vformat(msg190input3);
        
        
replace_all(msg190"!g""^x04"); // Green Color
        
replace_all(msg190"!n""^x01"); // Default Color
        
replace_all(msg190"!t""^x03"); // Team Color
        
        
if (idplayers[0] = id; else get_players(playerscount"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();
                        }
                }
        }



... 06-22-2014 10:11

Re: Round start pop out
 
You need not put same opp condition in else , but i think its not the cause of ur prob
PHP Code:

 else if (VipUsed[id]) ->  else {..} 

Other than that you need to make sure if u had reset the bool

nixh 06-22-2014 10:19

Re: Round start pop out
 
didint worked, or i didint edit corectly.

... 06-22-2014 10:33

Re: Round start pop out
 
Hello , as i said it before , you didn't reset your bool .
PHP Code:

#include <amxmodx>
#include <engine>
#include <hamsandwich>
#include <fun>
#include <cstrike>
#include <colorchat>

#define VIP_LEVEL ADMIN_CHAT

new const PREFIX[] = { "!g[YourTag]!n" };

new 
bool:VipUsed[33];

public 
plugin_init()
{
        
register_plugin("VIPMenu""1.0""whocares");
        
RegisterHam(Ham_Spawn"player""player_spawn"1);
        
register_event("HLTV","roundstart","a")
}

public 
roundstart()
{

    
    new 
players[32] , playernum 
    get_players
(players,playernum,"h")
    
    for(new 
playernum a++)
    {
    
VipUsed[players[a]] = false
    
}
}

public 
player_spawn(id)
{
    if(!
is_user_alive(id))
    return 
HAM_IGNORED
    
if(get_user_flags(id) & ADMIN_CHAT)
        
cmdVmenu(id)
   
    return 
HAM_IGNORED
}

public 
cmdVmenu(id)
{
        if(!(
get_user_flags(id) & ADMIN_CHAT))
        {
                
client_printc(id"%s You're not VIP member."PREFIX);
                return 
PLUGIN_HANDLED;
        }
        
        if(!
VipUsed[id])
        {
                switch(
cs_get_user_team(id))
                {
                        case 
CS_TEAM_CTVipCTMenu(id);
                        case 
CS_TEAM_TVipTMenu(id);
                }
        }
        else if (
VipUsed[id])
        {
                
client_printc(id"%s Wait for next Round."PREFIX);
        }
        return 
PLUGIN_HANDLED;
}

public 
VipCTMenu(id)
{
        new 
menu menu_create("\rV\wIP \rM\wenu:""VipCTMenu_handler");

        
menu_additem(menu"\wScout no bullet""1"0);
        
menu_additem(menu"\wHE Grenade""2"0);
        
menu_additem(menu"\w+20HP""3"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
}

public 
VipCTMenu_handler(idmenuitem)
{
        if( 
item == MENU_EXIT )
        {
                
menu_destroy(menu);
                return 
PLUGIN_HANDLED;
        }

        switch(
item)
        {
                case 
0:
                {
                        
give_item(id"weapon_scout");
                        
cs_set_user_bpammo(idCSW_SCOUT0);
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_scout"id), 0);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed Scout");
                        
VipUsed[id] = true;
                }
                case 
1:
                {
                        
give_item(id"weapon_hegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed HeGrenade");
                        
VipUsed[id] = true;
                }
                case 
2:
                {
                        
set_user_health(idget_user_health(id) + 20);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed +20 Health");
                        
VipUsed[id] = true;
                }
        }

        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}

public 
VipTMenu(id)
{
        new 
menu menu_create("\rV\wIP \rM\wenu:""VipTMenu_handler");

        
menu_additem(menu"\wHE Grenade""1"0);
        
menu_additem(menu"\GGlock 2 bullets""2"0);
        
menu_additem(menu"\w2 FB""3"0);
        
menu_additem(menu"\w+30HP""4"0);
        
menu_additem(menu"\wSG Grenade""5"0);
        
        
menu_setprop(menuMPROP_EXITMEXIT_ALL);
        
menu_display(idmenu0);
}

public 
VipTMenu_handler(idmenuitem)
{
        if( 
item == MENU_EXIT )
        {
                
menu_destroy(menu);
                return 
PLUGIN_HANDLED;
        }

        switch(
item)
        {
                case 
0:
                { 
                        
give_item(id"weapon_hegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed HeGrenade");
                        
VipUsed[id] = true;
                }
                case 
1:
                {
                        
give_item(id"weapon_glock18");
                        
cs_set_user_bpammo(idCSW_GLOCK180);
                        
cs_set_weapon_ammo(find_ent_by_owner(1"weapon_glock18"id), 2);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed Glock with 2 bullets");
                        
VipUsed[id] = true;
                }               
                case 
2:
                {
                        
give_item(id"weapon_flashbang");
                        
give_item(id"weapon_flashbang");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed 2 Flash grenades");
                        
VipUsed[id] = true;                     
                }  
                case 
3
                { 
                        
set_user_health(idget_user_health(id) + 30);
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed +20 Health");
                        
VipUsed[id] = true;
                }
                case 
4
                { 
                        
give_item(id"weapon_smokegrenade");
                        
ColorChat(idNORMAL"^x04[^x03YourTag^x04]^x01 You choosed SmokeGrenade");
                        
VipUsed[id] = true;
                }
        }

        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
}

stock client_printc(const id, const input[], any:...)
{
        new 
count 1players[32];
        static 
msg[191];
        
vformat(msg190input3);
        
        
replace_all(msg190"!g""^x04"); // Green Color
        
replace_all(msg190"!n""^x01"); // Default Color
        
replace_all(msg190"!t""^x03"); // Team Color
        
        
if (idplayers[0] = id; else get_players(playerscount"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();
                        }
                }
        }



nixh 06-22-2014 10:38

Re: Round start pop out
 
Thanks for the help.:up:


All times are GMT -4. The time now is 21:10.

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