AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   slowdown (https://forums.alliedmods.net/showthread.php?t=188850)

JenProchazim 07-01-2012 04:06

slowdown
 
Hello i need help with my plugin for furien, i'm newbie, so please someone help, here's my code. TT have in shop menu no slowdown ( bullets not slow you).

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)
    }



ConnorMcLeod 07-01-2012 04:10

Re: slowdown
 
Seeing your code, it is obvious that you absolutely don't know what you are doing.
So, don't post in scripting help forum, make a request in request forum.
Locked.


All times are GMT -4. The time now is 15:22.

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