Raised This Month: $51 Target: $400
 12% 

slowdown


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
JenProchazim
Member
Join Date: Jun 2012
Old 07-01-2012 , 04:23   slowdown
Reply With Quote #1

Hello, i have problem with no slowdown plugin. I'm totaly newbie in coding, so please if anyone have time help me. This plugin should add TT ability to buy no slowdown(bullets not slow).

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

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

#define VERSION "0.0.1"

#define FLASHBANG_SEARCH_RADIUS 1500.0

new g_bHasNoSlowdown
#define SetUserNoSlowdown(%1)        g_bHasNoSlowdown |=   1<<(%1&31)
#define RemoveUserNoSlowdown(%1)        g_bHasNoSlowdown &= ~(1<<(%1&31))
#define HasUserNoSlowdown(%1)        g_bHasNoSlowdown &    1<<(%1&31)

const fPainShock 108
new g_pCvarPainShockFree
new g_iMaxPlayers
#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )
g_pCvarPainShockFree register_cvar("amx_painshockfree""1"FCVAR_SERVER)

new 
g_iCost[2]

public 
plugin_init()
{
    
register_plugin("Furien NoSlowdown"VERSION"ConnorMcLeod")
    new 
szConfigFile[128]
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile))
    
format(szConfigFilecharsmax(szConfigFile), "%s/furien/items/noslowdown.ini"szConfigFile);

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

    new 
szFurienName[32], szAntiName[32]

    new 
szDatas[64], szKey[16], szValue[32]
    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)
                        }
                    }
                }
            }
        }
    }
    
fclosefp )

    if( 
g_iCost[Furien] || g_iCost[AntiFurien] )
    {
        
furien_register_item(szFurienNameg_iCost[Furien], szAntiNameg_iCost[AntiFurien], "furien_buy_noslowdown")
    
        
register_forward(FM_FindEntityInSphere"FindEntityInSphere")
        
RegisterHam(Ham_Killed"player""CBasePlayer_Killed"true)

        
g_iMaxPlayers get_maxplayers()
    }
}

public 
client_putinserver(id)
{
    
RemoveUserNoSlowdown(id)
}

public 
CBasePlayer_Killed(id)
{
    
RemoveUserNoSlowdown(id)
}

public 
furien_team_change/*iFurien */ )
{
    if( !
g_iCost[Furien] || !g_iCost[AntiFurien] )
    {
        
g_bHasNoSlowdown 0
    
}
}

public 
furien_round_restart()
{
    
g_bHasNoSlowdown 0
}

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

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

    if( ~
HasUserNoSlowdown(id) )
    {
        if( 
furien_try_buy(idiItemCost) )
        {
            
SetUserNoSlowdownid )
            return 
ShopBought
        
}
        else
        {
            return 
ShopNotEnoughMoney
        
}
    }
    return 
ShopAlreadyHaveOne
}
public 
Player_TakeDamage(id)
{
    if( ~
HasUserNoSlowdown(id) && is_user_alive(id) || ( get_pcvar_num(g_pCvarPainShockFree) ) )
    {
        
set_pdata_float(idfPainShock1.05)
    }

JenProchazim is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-01-2012 , 04:42   Re: slowdown
Reply With Quote #2

When you make a request, it's better that you don't start the work unless you know what you are doing. And if you know what you are doing (this is obviously not your case), then you can post in scripting help forum.

Try this :

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>

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

#define VERSION "0.0.1"

new g_bHasNoSlowdown
#define SetUserNoSlowdown(%1)        g_bHasNoSlowdown |=   1<<(%1&31)
#define RemoveUserNoSlowdown(%1)        g_bHasNoSlowdown &= ~(1<<(%1&31))
#define HasUserNoSlowdown(%1)        g_bHasNoSlowdown &    1<<(%1&31)

#define m_fPainShock 108

new g_iCost[2]

public 
plugin_init()
{
    
register_plugin("Furien NoSlowdown"VERSION"ConnorMcLeod")
    new 
szConfigFile[128]
    
get_localinfo("amxx_configsdir"szConfigFilecharsmax(szConfigFile))
    
format(szConfigFilecharsmax(szConfigFile), "%s/furien/items/noslowdown.ini"szConfigFile);

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

    new 
szFurienName[32], szAntiName[32]

    new 
szDatas[64], szKey[16], szValue[32]
    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)
                        }
                    }
                }
            }
        }
    }
    
fclosefp )

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

        
RegisterHam(Ham_TakeDamage"player""OnCBasePlayer_TakeDamage_Post"true)
        
RegisterHam(Ham_Player_Jump"player""OnCBasePlayer_Jump_Post"true)
        
RegisterHam(Ham_Killed"player""OnCBasePlayer_Killed_Post"true)
    }
}

public 
client_putinserver(id)
{
    
RemoveUserNoSlowdown(id)
}

public 
OnCBasePlayer_Killed_Post(id)
{
    
RemoveUserNoSlowdown(id)
}

public 
furien_team_change/*iFurien */ )
{
    if( !
g_iCost[Furien] || !g_iCost[AntiFurien] )
    {
        
g_bHasNoSlowdown 0
    
}
}

public 
furien_round_restart()
{
    
g_bHasNoSlowdown 0
}

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

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

    if( ~
HasUserNoSlowdown(id) )
    {
        if( 
furien_try_buy(idiItemCost) )
        {
            
SetUserNoSlowdownid )
            return 
ShopBought
        
}
        else
        {
            return 
ShopNotEnoughMoney
        
}
    }
    return 
ShopAlreadyHaveOne
}

public 
OnCBasePlayer_TakeDamage_Post(id)
{
    if( 
HasUserNoSlowdown(id) && is_user_alive(id) )
    {
        
set_pdata_float(idm_fPainShock1.05)
    }
}

public 
OnCBasePlayer_Jump_Post(id)
{
    if( 
HasUserNoSlowdown(id) && is_user_alive(id) )
    {
        
set_pev(idpev_fuser20.0)
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
JenProchazim
Member
Join Date: Jun 2012
Old 07-01-2012 , 08:16   Re: slowdown
Reply With Quote #3

You're the best! One more question please, why can antifuriens buy multiple primary and secondary weapons? Only one weapon if i try to buy another weapon tell : you already have one. But if i want the others allow me buy multiple from shop without warning.
JenProchazim 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 22:00.


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