This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

Shop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ImYourBro
Senior Member
Join Date: Jun 2014
Old 07-08-2016 , 13:57   Shop
Reply With Quote #1

Hello

I made this shop menu, but i got some problems. The damage arent working when buying the weapons with the increased damage.

PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fakemeta>
#include <hamsandwich>
#include <fun>
#include <xs>
#include <sqlx>
#include <colorchat>

#define PLUGIN "Furien Shop"
#define VERSION "1.0"
#define AUTHOR "ImYourBro"

#define NORMAL DontChange
#define GREEN DontChange
#define TEAM_COLOR DontChange

#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

new const prefix[] = "^1[^4FURIEN SHOP^1]"

// Models for the weapons
new const g_SuperCutModel[] = "models/furien_mod/v_supercut.mdl";
new const 
g_SuperDeagleModel[] = "models/furien_mod/v_deagle.mdl";

// Shop Cvars
new furienshop_enable,
    
g_pCvarHEGCost,
    
g_pCvarFGCost,
    
g_pCvarSGCost,
    
g_pCvarSuperCutCost,
    
g_pCvarSDeagleCost,
    
g_pCvarM249Cost,
    
g_pCvarHPCostT25,
    
g_pCvarHPCostT50,
    
g_pCvarHPCostCT25,
    
g_pCvarHPCostCT50,
    
g_pCvarArmorCost;


new 
bool:g_bHasSuperKnife[32];
new 
bool:g_bHasSuperDeagle[32];


new 
g_iMaxPlayers;

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("say /shop""shopHandle")
    
register_clcmd("say_team /shop""shopHandle")
    
register_clcmd("say shop""shopHandle")
    
register_clcmd("say_team shop""shopHandle")


    
// Cvars for Shop
    
furienshop_enable register_cvar("furienshop_enable""1")
    
g_pCvarHEGCost register_cvar("furienshop_HEcost""4000")
    
g_pCvarFGCost register_cvar("furienshop_Flashcost""2000")
    
g_pCvarSGCost register_cvar("furienshop_Smokecost""1000")
    
g_pCvarSuperCutCost register_cvar("furienshop_SuperKnifecost""12000")
    
g_pCvarSDeagleCost register_cvar("furienshop_SuperDeaglecost""12000")
    
g_pCvarM249Cost register_cvar("furienshop_m249cost""12000")
    
g_pCvarHPCostT25 register_cvar("furienshop_HPT25cost""2000")
    
g_pCvarHPCostT50 register_cvar("furienshop_HPT50cost""4000")
    
g_pCvarHPCostCT25 register_cvar("furienshop_HPCT25cost""2000")
    
g_pCvarHPCostCT50 register_cvar("furienshop_HPCT50cost""4000")
    
g_pCvarArmorCost register_cvar("furienshop_Armorcost""4000")

    
// Ham Functions
    
RegisterHam(Ham_Spawn"player""Player_Spawn"1)
    
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Weap"1)
    
RegisterHam(Ham_Item_Deploy"weapon_knife""Ham_ItemDeploy_Knife"1)
    
RegisterHam(Ham_Item_Deploy"weapon_deagle""Ham_ItemDeploy_DGL"1)
    
    
g_iMaxPlayers get_maxplayers();
}

public 
plugin_precache()
{
    
precache_model(g_SuperDeagleModel);
    
precache_model(g_SuperCutModel);
}

public 
client_putinserver(id)
{
    
g_bHasSuperKnife[id] = false;
    
g_bHasSuperDeagle[id] = false;
}


public 
Player_Spawn(id)
{
    if(
is_user_alive(id))
    {
        
ColorChat(idDontChange"%s ^1Write ^4/shop ^1to open the shop menu!"prefix)
        
g_bHasSuperKnife[id] = false;
        
g_bHasSuperDeagle[id] = false;
    }
}


public 
client_disconnect(id)
{
    
g_bHasSuperKnife[id] = false;
    
g_bHasSuperDeagle[id] = false;
}



public 
shopHandle(id)
{
    if (!
get_pcvar_num(furienshop_enable))
    {
        
ColorChat(idDontChange"%s ^1The shop is currently ^4disabled!"prefix)
    } 
    else if (
is_user_alive(id)) 
    {

        new 
Text[64]

        if (
cs_get_user_team(id) == CS_TEAM_T)
        {
            new 
menuT menu_create("\y[\rFurien Shop\y]""FurienShop")
            
formatex(Textcharsmax(Text), "\wSuperKnife \y[\r%d $\y]"get_pcvar_num(g_pCvarSuperCutCost))
            
menu_additem(menuTText"0")
            
formatex(Textcharsmax(Text), "\wHE Grenade \y[\r%d $\y]"get_pcvar_num(g_pCvarHEGCost))
            
menu_additem(menuTText"1")
            
formatex(Textcharsmax(Text), "\wSmoke Grenade \y[\r%d $\y]"get_pcvar_num(g_pCvarSGCost))
            
menu_additem(menuTText"2")
            
formatex(Textcharsmax(Text), "\wFlashbang \y[\r%d $\y]"get_pcvar_num(g_pCvarFGCost))
            
menu_additem(menuTText"3")
            
formatex(Textcharsmax(Text), "\wHP 25+ \y[\r%d $\y]"get_pcvar_num(g_pCvarHPCostT25))
            
menu_additem(menuTText"4")
            
formatex(Textcharsmax(Text), "\wHP 50+ \y[\r%d $\y]"get_pcvar_num(g_pCvarHPCostT50))
            
menu_additem(menuTText"5")
            
formatex(Textcharsmax(Text), "\wArmor 100+ \y[\r%d $\y]"get_pcvar_num(g_pCvarArmorCost))
            
menu_additem(menuTText"6")

            
menu_setprop(menuTMPROP_EXITNAME"Quit")

            
menu_display(idmenuT)
        }
        else if (
cs_get_user_team(id) == CS_TEAM_CT)
        {
            new 
menuCT menu_create("\y[\rHuman Shop\y]""HumanShop")
            
formatex(Textcharsmax(Text), "\wSuper Deagle \y[\r%d $\y]"get_pcvar_num(g_pCvarSDeagleCost))
            
menu_additem(menuCTText"0")
            
formatex(Textcharsmax(Text), "\wM249 \y[\r%d $\y]"get_pcvar_num(g_pCvarM249Cost))
            
menu_additem(menuCTText"1")
            
formatex(Textcharsmax(Text), "\wHE Grenade \y[\r%d $\y]"get_pcvar_num(g_pCvarHEGCost))
            
menu_additem(menuCTText"2")
            
formatex(Textcharsmax(Text), "\wSmoke Grenade \y[\r%d $\y]"get_pcvar_num(g_pCvarSGCost))
            
menu_additem(menuCTText"3")
            
formatex(Textcharsmax(Text), "\wFlashbang \y[\r%d $\y]"get_pcvar_num(g_pCvarFGCost))
            
menu_additem(menuCTText"4")
            
formatex(Textcharsmax(Text), "\wHP 25+ \y[\r%d $\y]"get_pcvar_num(g_pCvarHPCostCT25))
            
menu_additem(menuCTText"5")
            
formatex(Textcharsmax(Text), "\wHP 50+ \y[\r%d $\y]"get_pcvar_num(g_pCvarHPCostCT50))
            
menu_additem(menuCTText"6")
            
formatex(Textcharsmax(Text), "\wArmor 100+ \y[\r%d $\y]"get_pcvar_num(g_pCvarArmorCost))
            
menu_additem(menuCTText"7")

            
menu_setprop(menuCTMPROP_EXITNAME"Quit")

            
menu_display(idmenuCT)
        }
    }
}

public 
FurienShop(idmenuTitem)
{
    if (!
is_user_alive(id))
    {
        
menu_destroy(menuT)
        return 
PLUGIN_HANDLED
    
}

    new 
iMoneygHealthgArmor
    iMoney 
cs_get_user_money(id)
    
gHealth get_user_health(id)
    
gArmor get_user_armor(id)

    switch(
item)
    {
        case 
0:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarSuperCutCost)) 
            { 
                if(!
g_bHasSuperKnife[id]) 
                { 
                    
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarSuperCutCost)); 
                    
g_bHasSuperKnife[id] = true
                    
give_item(id"weapon_knife"); 
                    
ColorChat(idDontChange"%s ^1You just bought ^3SuperKnife ^1for ^4%d"prefix,get_pcvar_num(g_pCvarSuperCutCost)) 
                } 
                else 
                { 
                    
ColorChat(id,DontChange,"%s ^1You already have ^3SuperKnife^1",prefix
                } 
            } 
            else 
            { 
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
1:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHEGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHEGCost));
                
give_item(id"weapon_hegrenade");
                
ColorChat(idDontChange"%s You just bought a ^3HE Grenade ^1for ^4%d"prefixget_pcvar_num(g_pCvarHEGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
2:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarSGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarSGCost));
                
give_item(id"weapon_smokegrenade");
                
ColorChat(idDontChange"%s You just bought a ^3Smoke Grenade ^1for ^4%d"prefixget_pcvar_num(g_pCvarSGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
3:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarFGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarFGCost));
                
give_item(id"weapon_flashbang");
                
ColorChat(idDontChange"%s You just bought a ^3Flashbang ^1for ^4%d"prefixget_pcvar_num(g_pCvarFGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
4:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHPCostCT25))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHPCostCT25));
                
set_user_health(idgHealth 25)
                
ColorChat(idDontChange"%s You just bought^3 25+ HP ^1for ^4%d"prefixget_pcvar_num(g_pCvarHPCostCT25))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
5:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHPCostCT50))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHPCostCT50));
                
set_user_health(idgHealth 50)
                
ColorChat(idDontChange"%s You just bought^3 50+ HP ^1for ^4%d"prefixget_pcvar_num(g_pCvarHPCostCT50))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
6:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarArmorCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarArmorCost));
                
set_user_armor(idgArmor 100)
                
ColorChat(idDontChange"%s You just bought^3 100+ Armor ^1for ^4%d"prefixget_pcvar_num(g_pCvarArmorCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }
    }
    
menu_destroy(menuT);
    return 
PLUGIN_HANDLED;
}

public 
HumanShop(idmenuCTitem)
{
    if (!
is_user_alive(id))
    {
        
menu_destroy(menuCT)
        return 
PLUGIN_HANDLED
    
}

    new 
iMoneygHealthgArmor
    gHealth 
get_user_health(id)
    
gArmor get_user_armor(id)
    
iMoney cs_get_user_money(id)

    switch(
item)
    {
        case 
0:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarSDeagleCost))
            {
                if (!
g_bHasSuperDeagle[id])
                {
                    
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarSDeagleCost));
                    
g_bHasSuperDeagle[id] = true;
                    
give_item(id"weapon_deagle")
                    
cs_set_user_bpammo(idCSW_DEAGLE35)
                    
ColorChat(idDontChange"%s You just bought ^3Super Deagle ^1for ^4%d"prefixget_pcvar_num(g_pCvarSDeagleCost))
                }
                else
                {
                    
ColorChat(idDontChange"%s You already have ^4Super Deagle"prefix)
                }
            }
            else
            {
                
ColorChat(idDontChange"%s You dont have enough ^4money"prefix)
            }
        }

        case 
1:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarM249Cost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarM249Cost));
                
give_item(id"weapon_m249");
                
ColorChat(idDontChange"%s You just bought a ^3M249 ^1for ^4%d"prefixget_pcvar_num(g_pCvarM249Cost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
2:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHEGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHEGCost));
                
give_item(id"weapon_hegrenade");
                
ColorChat(idDontChange"%s You just bought a ^3HE Grenade ^1for ^4%d"prefixget_pcvar_num(g_pCvarHEGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
3:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarSGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarSGCost));
                
give_item(id"weapon_smokegrenade");
                
ColorChat(idDontChange"%s You just bought a ^3Smoke Grenade ^1for ^4%d"prefixget_pcvar_num(g_pCvarSGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
4:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarFGCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarFGCost));
                
give_item(id"weapon_flashbang");
                
ColorChat(idDontChange"%s You just bought a ^3Flashbang ^1for ^4%d"prefixget_pcvar_num(g_pCvarFGCost))
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
5:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHPCostT25))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHPCostT25));
                
set_user_health(idgHealth 25)
                
ColorChat(idDontChange"%s You just bought^3 25+ HP ^1for ^4%d"prefixget_pcvar_num(g_pCvarHPCostT25), gHealth)
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
6:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarHPCostT50))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarHPCostT50));
                
set_user_health(idgHealth 50)
                
ColorChat(idDontChange"%s You just bought^3 50+ HP ^1for ^4%d"prefixget_pcvar_num(g_pCvarHPCostT50), gHealth)
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }

        case 
7:
        {
            if ( 
iMoney >= get_pcvar_num(g_pCvarArmorCost))
            {
                
cs_set_user_money(idiMoney get_pcvar_num(g_pCvarArmorCost));
                
set_user_armor(idgArmor 100)
                
ColorChat(idDontChange"%s You just bought^3 100+ Armor ^1for ^4%d"prefixget_pcvar_num(g_pCvarArmorCost), gArmor)
            }
            else
            {
                
ColorChat(idDontChange"%s You do not have enough ^4money!"prefix)
            }
        }
    }
    
menu_destroy(menuCT);
    return 
PLUGIN_HANDLED;
}

public 
Ham_TakeDamage_Weap(victiminflictorattackerFloat:damagedamage_bits
{
    if (
IsPlayer(attacker) || !is_user_aliveattacker ) || inflictor != attacker)
    {
        return;
    }

    if (
g_bHasSuperKnife[attacker] && cs_get_user_team(attacker) == CS_TEAM_T && get_user_weapon(attacker) == CSW_KNIFE)
    {
        
SetHamParamFloat(4damage 2.4)
    }

    if (
g_bHasSuperDeagle[attacker] && cs_get_user_team(attacker) == CS_TEAM_CT && get_user_weapon(attacker) == CSW_DEAGLE)
    {
        
SetHamParamFloat(4damage 1.4)
    }
}

public 
Ham_ItemDeploy_Knife(weapon_ent)
{
   static 
owner;
   
owner get_pdata_cbase(weapon_ent414);

   if(
is_user_alive(owner) && g_bHasSuperKnife[owner])
   {
      
set_pev(ownerpev_viewmodel2g_SuperCutModel);
   }
}

public 
Ham_ItemDeploy_DGL(weapon_ent)
{
    static 
owner;
    
owner get_pdata_cbase(weapon_ent414)

    if (
is_user_alive(owner) && g_bHasSuperDeagle[owner])
    {    
        
set_pev(ownerpev_viewmodel2g_SuperDeagleModel)
    }

__________________
Hello!
I'm learning AMXX right now, so please No Hate if i suck

-----------------------------------------------------------------------
Check out my Furien Mod v0.3 here

ImYourBro is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-08-2016 , 14:01   Re: Shop
Reply With Quote #2

PHP Code:
if (IsPlayer(attacker) || !is_user_aliveattacker ) || inflictor != attacker
!IsPlayer

Also, shouldn't you hook pre-damage event, instead of post? I don't think it's logically possible to change the damage amount after it has been done.
__________________

Last edited by OciXCrom; 07-08-2016 at 14:10.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
KaLoIaN
Senior Member
Join Date: Feb 2013
Old 07-08-2016 , 14:08   Re: Shop
Reply With Quote #3

Make your bools 33 cells instead of 32 also.
KaLoIaN is offline
ImYourBro
Senior Member
Join Date: Jun 2014
Old 07-08-2016 , 14:56   Re: Shop
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
if (IsPlayer(attacker) || !is_user_aliveattacker ) || inflictor != attacker
!IsPlayer

Also, shouldn't you hook pre-damage event, instead of post? I don't think it's logically possible to change the damage amount after it has been done.
lol, didnt even notice that. But thanks. Im tired so my eyes are burned
__________________
Hello!
I'm learning AMXX right now, so please No Hate if i suck

-----------------------------------------------------------------------
Check out my Furien Mod v0.3 here

ImYourBro is offline
ImYourBro
Senior Member
Join Date: Jun 2014
Old 07-08-2016 , 15:15   Re: Shop
Reply With Quote #5

Nah. Still didnt work :d
__________________
Hello!
I'm learning AMXX right now, so please No Hate if i suck

-----------------------------------------------------------------------
Check out my Furien Mod v0.3 here

ImYourBro is offline
cr23
Junior Member
Join Date: Mar 2016
Old 07-09-2016 , 23:10   Re: Shop
Reply With Quote #6

Try this ?

change 4 to 3

PHP Code:
SetHamParamFloat(3damage damage_multiple 
cr23 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-09-2016 , 23:23   Re: Shop
Reply With Quote #7

No cr23, inst 3, need to be 4.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
cr23
Junior Member
Join Date: Mar 2016
Old 07-09-2016 , 23:44   Re: Shop
Reply With Quote #8

and that realy at pre-damage event like OciXCrom say?

PHP Code:
RegisterHam(Ham_TakeDamage"player""Ham_TakeDamage_Weap"0

Last edited by cr23; 07-09-2016 at 23:54. Reason: some word wrong
cr23 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:51.


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