Raised This Month: $ Target: $400
 0% 

Shop request


Post New Thread Reply   
 
Thread Tools Display Modes
Kia
AlliedModders Donor
Join Date: Apr 2010
Location: In a world of madness
Old 06-26-2013 , 14:40   Re: Shop request
Reply With Quote #11

Just regive the weapon or use Ham to set viewmodel without weapon switch.
__________________
Kia is offline
Jhob94
AMX Mod X Donor
Join Date: Jul 2012
Old 06-26-2013 , 17:46   Re: Shop request
Reply With Quote #12

i know how to do... Iam just busy making one server now x)

EDIT:
PHP Code:
#include <amxmodx>
#include <cstrike>
#include <fun>
#include <fakemeta>
#include <hamsandwich>

#include "furien.inc"
#include "furien_shop.inc"

#define VERSION "Jhob94"

#define FIRST_PLAYER_ID    1

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

#define XO_WEAPON 4
#define m_pPlayer 41

#define XO_PLAYER        5
#define m_pActiveItem    373

new g_bHasGoldDeagle
#define SetUserGoldDeagle(%1)        g_bHasGoldDeagle |= 1<<(%1&31)
#define RemoveUserGoldDeagle(%1)    g_bHasGoldDeagle &= ~(1<<(%1&31))
#define HasUserGoldDeagle(%1)        g_bHasGoldDeagle & 1<<(%1&31)

new g_iszGoldDeagleModel
new Float:g_flGoldDeagleDamageFactor

new g_iCost[2]

public 
plugin_precache()
{
    
register_plugin("Furien Gold Deagle"VERSION"ConnorMcLeod")

    new 
szConfigFile[128]
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile))
    
format(szConfigFilecharsmax(szConfigFile), "%s/furien/items/gold_deagle.ini"szConfigFile);

    new 
fp fopen(szConfigFile"rt")
    if( !
fp )
    {
        return
    }

    new 
szFurienName[32], szAntiName[32]

    new 
szDatas[80], szKey[16], szValue[64]
    while( !
feof(fp) )
    {
        
fgets(fpszDatascharsmax(szDatas))
        
trim(szDatas)
        if(!
szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/'))
        {
            continue
        }

        
parse(szDatasszKeycharsmax(szKey), szValuecharsmax(szValue))

        switch( 
szKey[0] )
        {
            case 
'A':
            {
                switch( 
szKey[7] )
                {
                    case 
'M':
                    {
                        if( 
equal(szKey"ANTI_NAME" ) )
                        {
                            
copy(szAntiNamecharsmax(szAntiName), szValue)
                        }
                    }
                    case 
'S':
                    {
                        if( 
equal(szKey"ANTI_COST" ) )
                        {
                            
g_iCost[AntiFurien] = str_to_num(szValue)
                        }
                    }
                }
            }
            case 
'F':
            {
                switch( 
szKey[9] )
                {
                    case 
'M':
                    {
                        if( 
equal(szKey"FURIEN_NAME" ) )
                        {
                            
copy(szFurienNamecharsmax(szAntiName), szValue)
                        }
                    }
                    case 
'S':
                    {
                        if( 
equal(szKey"FURIEN_COST" ) )
                        {
                            
g_iCost[Furien] = str_to_num(szValue)
                        }
                    }
                }
            }
            case 
'K':
            {
                switch( 
szKey[6] )
                {
                    case 
'M':
                    {
                        if( 
equal(szKey"GDEAGLE_MODEL" ) )
                        {
                            
precache_model(szValue)
                            
g_iszGoldDeagleModel engfunc(EngFunc_AllocStringszValue)
                        }
                    }
                    case 
'D':
                    {
                        if( 
equal(szKey"GDEAGLE_DAMAGE" ) )
                        {
                            
g_flGoldDeagleDamageFactor str_to_float(szValue)
                        }
                    }
                }
            }
        }
    }
    
fclosefp )

    if( 
g_iCost[Furien] || g_iCost[AntiFurien] )
    {
        
furien_register_item(szFurienNameg_iCost[Furien], szAntiNameg_iCost[AntiFurien], "furien_buy_gold_deagle")    

        
RegisterHam(Ham_Killed"player""Ham_CBasePlayer_Killed_Post"true)
        
RegisterHam(Ham_TakeDamage"player""CBasePlayer_TakeDamage"false)
        
RegisterHam(Ham_Item_Deploy"weapon_deagle""GDeagle_Deploy"true)

        
g_iMaxPlayers get_maxplayers()
    }
}

public 
client_putinserver(id)
{
    
RemoveUserGoldDeagle(id)
}

public 
furien_buy_gold_deagleid )
{
    new 
iTeam furien_get_user_team(id)
    if( 
iTeam == -)
    {
        return 
ShopCloseMenu
    
}

    new 
iItemCost g_iCost[iTeam]
    if( 
iItemCost <= )
    {
        return 
ShopTeamNotAvail
    
}

    if( ~
HasUserGoldDeagle(id) )
    {
        if( 
furien_try_buy(idiItemCost) )
        {
            
SetUserGoldDeagle(id)
            
give_item(id"weapon_deagle"
            
cs_set_user_bpammo(idCSW_DEAGLE35)
            if(
get_user_weapon(id) == CSW_DEAGLE)
            {
                    
set_pev(idpev_viewmodel2g_iszGoldDeagleModel)
            }
            return 
ShopBought
        
}
        else
        {
            return 
ShopNotEnoughMoney
        
}
    }
    return 
ShopAlreadyHaveOne
}

public 
GDeagle_DeployiKnife )
{
    new 
id get_pdata_cbase(iKnifem_pPlayerXO_WEAPON)

    if( 
HasUserGoldDeagle(id) )
    {
        
set_pev(idpev_viewmodelg_iszGoldDeagleModel)
    }
}

public 
CBasePlayer_TakeDamage(idiInflictoriAttackerFloat:flDamagebitsDamageType)
{
    if( 
IsPlayer(iInflictor) && HasUserGoldDeagle(iAttacker) && get_user_weapon(iAttacker) == CSW_KNIFE )
    {
        
SetHamParamFloat4flDamage g_flGoldDeagleDamageFactor )
    }
}

public 
Ham_CBasePlayer_Killed_Post(id)
{
    
RemoveUserGoldDeagle(id)
}

public 
furien_team_change/*iFurien */ )
{
    if( !
g_iCost[Furien] || !g_iCost[AntiFurien] )
    {
        new 
iPlayers[32], iNumid
        get_players
(iPlayersiNum"a")
        for(new 
ii<iNumi++)
        {
            
id iPlayers[i]
            if( 
HasUserGoldDeagle(id) )
            {
                
RemoveUserGoldDeagle(id)
                if( 
get_user_weapon(id) == CSW_DEAGLE )
                {
                    
ExecuteHamB(Ham_Item_Deployget_pdata_cbase(idm_pActiveItemXO_PLAYER))
                }
            }
        }
        
g_bHasGoldDeagle 0
    
}
}

public 
furien_round_restart()
{
    
g_bHasGoldDeagle 0

__________________

Last edited by Jhob94; 06-26-2013 at 17:50.
Jhob94 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 00:11.


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