AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Buy menu plugin (https://forums.alliedmods.net/showthread.php?t=187710)

pizzaman_ 06-16-2012 20:32

Buy menu plugin
 
1 Attachment(s)
this plugin works fine but now i want to change some stuff, want to disable all features in the menu except no recoil and invisibility so plugin help my 4fun server


this is main menu:

"SilentWalk",
"NoClip",
"Chameleon",
"Unlimited Ammo",
"Invisibility",
"NoFlash",
"NoRecoil",
"Speed"

i just want NoRecoil and Invisibility features, thank you all :D

Neeeeeeeeeel.- 06-16-2012 22:37

Re: Buy menu plugin
 
PHP Code:

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

new bool:norecoil[33]

new 
pcvars[3]
new 
Messages[][] ={
    
"Type /buy to open up the buy menu!",
    
"Now No One Can See You!",
    
"Now You Have No Recoil!"
}
new 
Names[][] ={
    
"",
    
"Invisibility",
    
"NoRecoil"
}

public 
plugin_init() {
    
register_plugin("Buy_Menu","iMiNDFREAK","v1.8")
    
    
pcvars[0] = register_cvar("buy_menu","1")
    
pcvars[1] = register_cvar("buy_invisibility""1000"
    
pcvars[2] = register_cvar("buy_norecoil""1000"
    
    
register_clcmd"say /buy","ShowBuyMenu")
    
register_clcmd"say_team /buy","ShowBuyMenu")
    
    
register_event("CurWeapon","Change_Gun","be","1=1")
    
register_logevent("ResetBonuses"2"1=Round_End")
    
}

public 
ShowBuyMenu(id
{
    if(
get_pcvar_num(pcvars[0]) == 0
    { 
        
client_print(idprint_chat""
        return 
PLUGIN_HANDLED     
    

    
    new 
menu menu_create("Buy Menu" "buy_handle");
    
    new 
i=1,nr[3]
    new 
Form[50]
    for (
i=1i<sizeof Namesi++)
    {
        
format(nr,2,"%i",i)
        
format(Form,49,"%s: $%i",Names[i],get_pcvar_num(pcvars[i]))
        
menu_additem(menu ,Formnr 0);
    }
    
    
menu_setprop(menu MPROP_EXIT MEXIT_ALL);
    
    
menu_display(id menu 0);
    return 
PLUGIN_CONTINUE
}
public 
buy_handle(id menu item)
{    
    if(
item == MENU_EXIT
    {
        
client_print(idprint_chat"")
        
menu_destroy(menu);
    }
    
    new 
szCommand[6] , szName[64];
    new 
access callback;
    
    
menu_item_getinfo(menu item access szCommand szName 63 callback);
    
    new 
str_to_num(szCommand)
    new 
money cs_get_user_money(id
    new 
cost get_pcvar_num(pcvars[i])
    
    if(
money cost
    {
        
client_print(idprint_chat""cost
        return 
PLUGIN_HANDLED
    
}
    
    
cs_set_user_money(idmoney-cost,1)
    
client_print(idprint_chat"",Messages[i])
    switch (
i){
        
        case 
1set_user_rendering(id,kRenderFxNone0,0,0kRenderTransAdd,30
        case 
2:norecoil[id]=true
    
}
    
    return 
PLUGIN_HANDLED
}

public 
Change_Gun(id

    if (
norecoil[id])
    {
        
entity_set_vector(idEV_VEC_punchangleFloat:{0.00.00.0})
    }
    
    return 
PLUGIN_CONTINUE 
}

public 
RoundStart(id)
{
            
norecoil[id]=false
            set_user_rendering
(id,kRenderFxNone0,0,0kRenderNormal,255)




All times are GMT -4. The time now is 06:11.

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