Raised This Month: $ Target: $400
 0% 

[AYUDA][FM] Drop Katana


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MLZz3
BANNED
Join Date: Mar 2013
Location: Granada, Andalucia, Spai
Old 04-07-2013 , 14:19   [AYUDA][FM] Drop Katana
#1

Bueno, como dice el titulo, me gustaría que cuando un jugador tienes la katana y le matan, mediante una cvar, si es 1 katana se le caiga al suelo y si la cvar es 0 que simplemente no se le caiga, vamos que desaparezca, esto ya lo tenia hecho, pero perdí el código y ya no me acuerdo como lo hice, ya que me ayudo un amigo por privado hace como 1 año, por favor chicos os lo agresco mucho si me ayudáis.

PD: Si se tira la katana al suelo, se tendra que añadir w_katana.mdl.

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

#include <amxmodx>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

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

#define VERSION "0.2.0"

#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_bHasSuperKnife;
#define SetUserSuperKnife(%1)        g_bHasSuperKnife |= 1<<(%1&31)
#define RemoveUserSuperKnife(%1)        g_bHasSuperKnife &= ~(1<<(%1&31))
#define HasUserSuperKnife(%1)        g_bHasSuperKnife & 1<<(%1&31)

new g_iszSuperKnifeModel
new Float:g_flSuperKnifeDamageFactor

new g_iCost];

public 
plugin_precache( )
{
    
register_plugin"Furien SuperKnife"VERSION"ConnorMcLeod" );

    new 
szConfigFile128 ];
    
get_localinfo"amxx_configsdir"szConfigFilecharsmaxszConfigFile ) )
    
formatszConfigFilecharsmaxszConfigFile ), "%s/furien/items/superknife.ini"szConfigFile );

    new 
fp fopenszConfigFile"rt" )
    if( !
fp )
        return;

    new 
szFurienName32 ], szAntiFurienName32 ];

    new 
szDatas80 ], szKey16 ], szValue64 ];
    while( !
feoffp ) )
    {
        
fgetsfpszDatascharsmaxszDatas ) )
        
trimszDatas )
        if( !
szDatas] || szDatas] == ';' || szDatas] == '#' || ( szDatas] == '/' && szDatas] == '/' ) )
            continue;

        
parseszDatasszKeycharsmaxszKey ), szValuecharsmaxszValue ) )

        switch( 
szKey] )
        {
            case 
'F':
            {
                switch( 
szKey] )
                {
                    case 
'M':
                    {
                        if( 
equal(szKey"FURIEN_NAME" ) )
                            
copyszFurienNamecharsmaxszAntiFurienName ), szValue )
                    }
                    case 
'S':
                    {
                        if( 
equalszKey"FURIEN_COST" ) )
                            
g_iCostFurien ] = str_to_numszValue )
                    }
                }
            }
            case 
'A':
            {
                switch( 
szKey] )
                {
                    case 
'M':
                    {
                        if( 
equalszKey"ANTIFURIEN_NAME" ) )
                            
copyszAntiFurienNamecharsmaxszAntiFurienName ), szValue )
                    }
                    case 
'S':
                    {
                        if( 
equalszKey"ANTIFURIEN_COST" ) )
                            
g_iCostAntiFurien ] = str_to_numszValue )
                    }
                }
            }
            case 
'K':
            {
                switch( 
szKey] )
                {
                    case 
'M':
                    {
                        if( 
equalszKey"SUPERKNIFE_MODEL" ) )
                        {
                            
g_iszSuperKnifeModel engfuncEngFunc_AllocStringszValue )
                            
precache_modelszValue )
                        }
                    }
                    case 
'D':
                    {
                        if( 
equalszKey"SUPERKNIFE_DAMAGE" ) )
                            
g_flSuperKnifeDamageFactor str_to_floatszValue )
                    }
                }
            }
        }
    }
    
fclosefp )

    if( 
g_iCostFurien ] || g_iCostAntiFurien ] )
    {
        
furien_register_itemszFurienNameg_iCostFurien ], szAntiFurienNameg_iCostAntiFurien ], "furien_buy_superknife" )    

        
RegisterHamHam_Item_Deploy"weapon_knife""CKnife_Deploy"true )
        
RegisterHamHam_TakeDamage"player""CBasePlayer_TakeDamage"false )
        
RegisterHamHam_Killed"player""CBasePlayer_Killed"true )

        
g_iMaxPlayers get_maxplayers( )
    }
}

public 
client_putinserverid )
    
RemoveUserSuperKnifeid )

public 
furien_buy_superknifeid )
{
    new 
iTeam furien_get_user_teamid )
    if( 
iTeam == -)
        return 
ShopCloseMenu;

    new 
iItemCost g_iCostiTeam ]
    if( 
iItemCost <= )
        return 
ShopTeamNotAvail;

    if( ~
HasUserSuperKnifeid ) )
    {
        if( 
furien_try_buyidiItemCost ) )
        {
            
SetUserSuperKnifeid )
            if( 
get_user_weaponid ) == CSW_KNIFE )
                
ExecuteHamBHam_Item_Deployget_pdata_cbaseidm_pActiveItemXO_PLAYER ) )
            return 
ShopBought;
        }
        else
            return 
ShopNotEnoughMoney;
    }
    return 
ShopAlreadyHaveOne;
}

public 
CKnife_DeployiKnife )
{
    new 
id get_pdata_cbaseiKnifem_pPlayerXO_WEAPON )

    if( 
HasUserSuperKnifeid ) )
        
set_pevidpev_viewmodelg_iszSuperKnifeModel )
}

public 
CBasePlayer_TakeDamageidiInflictoriAttackerFloat:flDamagebitsDamageType )
{
    if( 
IsPlayeriInflictor ) && HasUserSuperKnifeiAttacker ) && get_user_weaponiAttacker ) == CSW_KNIFE )
        
SetHamParamFloat4flDamage g_flSuperKnifeDamageFactor )
}

public 
CBasePlayer_Killedid )
    
RemoveUserSuperKnifeid )

public 
furien_round_restart( )
    
g_bHasSuperKnife 

Last edited by MLZz3; 04-07-2013 at 14:57. Reason: Add PD.
MLZz3 is offline
Send a message via Skype™ to MLZz3
 



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 06:33.


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