| 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", szConfigFile, charsmax(szConfigFile)) format(szConfigFile, charsmax(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(fp, szDatas, charsmax(szDatas)) trim(szDatas) if(!szDatas[0] || szDatas[0] == ';' || szDatas[0] == '#' || (szDatas[0] == '/' && szDatas[1] == '/')) { continue }
parse(szDatas, szKey, charsmax(szKey), szValue, charsmax(szValue))
switch( szKey[0] ) { case 'A': { switch( szKey[7] ) { case 'M': { if( equal(szKey, "ANTI_NAME" ) ) { copy(szAntiName, charsmax(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(szFurienName, charsmax(szAntiName), szValue) } } case 'S': { if( equal(szKey, "FURIEN_COST" ) ) { g_iCost[Furien] = str_to_num(szValue) } } } } } } fclose( fp )
if( g_iCost[Furien] || g_iCost[AntiFurien] ) { furien_register_item(szFurienName, g_iCost[Furien], szAntiName, g_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_noslowdown( id ) { new iTeam = furien_get_user_team(id) if( iTeam == -1 ) { return ShopCloseMenu }
new iItemCost = g_iCost[iTeam] if( iItemCost <= 0 ) { return ShopTeamNotAvail }
if( ~HasUserNoSlowdown(id) ) { if( furien_try_buy(id, iItemCost) ) { SetUserNoSlowdown( id ) 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(id, fPainShock, 1.0, 5) } }
|