[ create a new paste ] login | about

Link: http://codepad.org/a7ladd2H    [ raw code | fork ]

Raheem - C, pasted on Jul 18:
#include <amxmodx>
#include <cstrike>

new menu
new money

public plugin_init()
{
	register_plugin("Zombie Escape Guns Shop", "1.1", "Raheem")
	register_clcmd("shop","ShowMenu")
}

public ShowMenu(id)
{
	menu = menu_create( "\y[\wZombie Escape\y] \rGuns Menu", "menu_handler" )
	
	menu_additem( menu, "Golden AK-47\R\r1000 $", "", 0 )
	menu_additem( menu, "Golden MP5\R\r5000 $", "", 0 )
	menu_additem( menu, "Golden M4A1\R\r7000 $", "", 0 )
	menu_additem( menu, "Etherael\R\r10000 $", "", 0 )
	menu_additem( menu, "Plasma Gun \y[\rVIP\y]\R\r6000 $", "", ADMIN_LEVEL_H )
	menu_additem( menu, "M134 \y[\rVIP\y]\R\r 0 $", "", ADMIN_LEVEL_H )
	
	menu_setprop( menu, MPROP_EXIT, MEXIT_ALL )
	
	if(cs_get_user_team(id) == CS_TEAM_T)
	{
		client_print_color(id, "!y[!gZombie Escape!y] !tThis menu for humans only!y.")
	}
	else
	{
		menu_display( id, menu, 0 )
	}
}

public menu_handler(id, menu, item)
{
	money = cs_get_user_money(id)
	
	switch(item)
	{
		case 0:
		{
			if(money >= 1000)
			{
				client_cmd(id, "ak47")
				client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought Golden Ak-47!y.")
			}
			else
			{
				client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough money!y.")
			}
		}				
		case 1:
		{
			if(money >= 5000)
			{
				client_cmd(id, "mp5")
				client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought Golden MP5!n.")
			}
			else
			{
				client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough money!y.")
			}
		}
		case 2:
		{
			if(money >= 7000)
			{
				client_cmd(id, "m4a1")
				client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought Golden M4A1!n.")
			}
			else
			{
				client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough money!y.")
			}
		}
		case 3:
		{
			if (money >= 10000)
			{
				client_cmd(id, "eth")
				client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought Etherael Gun!n.")
			}
			else
			{
				client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough money!y.")
			}		
		}
		case 4:
		{
			if (money >= 6000)
			{
				client_cmd(id, "vip_poison")
				cs_set_user_money(id, money - 6000)
				client_print_color(id, "!y[!gZombie Escape!y] !tYou have bought Plasma gun!n.")
			}
			else
			{
				client_print_color(id, "!y[!gZombie Escape!y] !tYou don't have enough money!y.")
			}
		}
		case 5:
		{
			client_cmd(id, "m134")
		}
	}
	
	menu_destroy(menu)
	return PLUGIN_HANDLED
}
			
stock client_print_color(const id, const input[], any:...)  
{  
    new count = 1, players[32];  
    static msg[191];  
    vformat(msg, 190, input, 3);  

    replace_all(msg, 190, "!g", "^x04"); // Green Color  
    replace_all(msg, 190, "!y", "^x01"); // Default Color  
    replace_all(msg, 190, "!t", "^x03"); // 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();  
            }  
        }  
    }  
}


Create a new paste based on this one


Comments: