Raised This Month: $ Target: $400
 0% 

shop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Ex1ne
Senior Member
Join Date: Oct 2011
Location: Norway
Old 04-14-2012 , 12:11   Re: shop
Reply With Quote #4

Untested
Note: I did not change any cvar's, change them yourself.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <nvault>
#include <hamsandwich>
#include <fakemeta>


/* --| Let's force the semicolon on every endline */
#pragma semicolon 1

/* --| Some defines :) */
#define PICKUP_SND        "items/gunpickup2.wav"
#define HEALTH_SOUND        "items/smallmedkit1.wav"
#define ARMOR_SOUND        "items/ammopickup2.wav"
#define CLOACK_SOUND        "hornet/ag_buzz1.wav"
#define LJ_SOUND        "fvox/powermove_on.wav"
#define SOUND_NVGOFF        "items/nvg_off.wav"
#define ADMIN_ACCESS_CMD    ADMIN_KICK    
#define HAS_NVGS        (1<<0)
#define USES_NVGS        (1<<8)
#define get_user_nvg(%1)        (get_pdata_int(%1,m_iNvg) & HAS_NVGS)
#define fm_get_user_cash(%1)    get_pdata_int(%1, 115)
/* --| Plugin informations */
new const PLUGIN[]     = "Deathrun Shop";
new const 
VERSION[]     = "4.0";
new const 
AUTHOR[]     = "tuty";

/* --| Zomg lot of globals :) */
new gDrShopOn;
new 
gHeCost;
new 
gBothGrenadesCost;
new 
gSilentCost;
new 
gHealthCost;
new 
gArmorCost;
new 
gSpeedCost;
new 
gGravityCost;
new 
gInvisCost;
new 
gSpeedCvar;
new 
gGravityCvar;
new 
gAdvertiseCvar;
new 
gHealthPointCvar;
new 
gArmorPointCvar;
new 
gAdvertiseTimeCvar;
new 
gInvisPercent;
new 
gSuiciderPointsCvar;
new 
gNoclipCost;
new 
gNoclipTime;
new 
gJetSprite;
new 
gJetPackCost;
new 
gJetTime;
new 
gDeagleCost;
new 
gMsgItemPickup;
new 
gLongJumpTime;
new 
gLongJumpCost;
new 
gGlowCost;
new 
gNvgCost;
new 
gMessageNVG;

/* --| Item variables */
new HasHe33 ];
new 
HasBothGren33 ];
new 
HasSilent33 ];
new 
HasHealth33 ];
new 
HasArmor33 ];
new 
HasSpeed33 ];
new 
HasGravity33 ];
new 
HasInvis33 ];
new 
HasNoclip33 ];
new 
HasJet33 ];
new 
HasDeagle33 ];
new 
HasLongJump33 ];
new 
HasGlow33 ];
new 
HasNVG33 ];

/* --| Player points, need this to save points, load points, etc */

/* --| Offsets for nvg */
const m_iNvg 129;
const 
m_iLinuxDiff 5;

/* --| So, let's get started */
public plugin_init()
{
    
/* --| Registering the plugin to show when you type amx_plugins.. */
    
register_pluginPLUGINVERSIONAUTHOR );
    
    
/* --| Registering a little cvar to see wich servers using this plugin */
    
register_cvar"drshop_version"VERSIONFCVAR_SERVER FCVAR_SPONLY );
    
    
/* --| Register some usefull events */
    
register_logevent"logevent_round_start"2"1=Round_Start" );
    
register_event"CurWeapon""HookCurWeapon""be""1=1" );
    
    
/* --| Called when a player is performing a jump */
    
RegisterHamHam_Player_Jump"player""bacon_playerJumping" );
    
    
/* --| We need this forward to find if player has suicided with kill in console */
    /* --| We can't do that on deathmsg because player die in traps by suicide,.. trigger_hurt or world.. etc */
    
register_forwardFM_ClientKill"forward_kill" );
    
    
    
/* --| Command for opening the menu */
    
register_clcmd"say /drshop""DeathrunShop" );
    
register_clcmd"say_team /drshop""DeathrunShop" );
    
    
/* --| Command to see our points :) */
    
    
    /* --| Let's register the cvars, a lot of cvars but huh.. stf :) */
    
gDrShopOn register_cvar"deathrun_shop""1" );
    
gHeCost register_cvar"deathrun_he_cost""10" ); 
    
gBothGrenadesCost register_cvar"deathrun_bothgrenades_cost""20" );
    
gSilentCost register_cvar"deathrun_silent_cost""24" );
    
gHealthCost register_cvar"deathrun_health_cost""30" );
    
gArmorCost register_cvar"deathrun_armor_cost""15" );
    
gSpeedCost register_cvar"deathrun_speed_cost""39" );
    
gGravityCost register_cvar"deathrun_gravity_cost""41" );
    
gNoclipCost register_cvar"deathrun_noclip_cost""50" );
    
gJetPackCost register_cvar"deathrun_jetpack_cost""60" );
    
gInvisCost register_cvar"deathrun_invisibility_cost""69" );
    
gSpeedCvar register_cvar"deathrun_speed_power""400.0" );
    
gNoclipTime register_cvar"deathrun_noclip_duration""2" );
    
gJetTime register_cvar"deathrun_jetpack_duration""10" );
    
gDeagleCost register_cvar"deathrun_deagle_cost""31" );
    
gGravityCvar register_cvar"deathrun_gravity_power""0.7" );
    
gAdvertiseCvar register_cvar"deathrun_advertise_message""1" );
    
gHealthPointCvar register_cvar"deathrun_health_points""255" );
    
gArmorPointCvar register_cvar"deathrun_armor_points""400" );
    
gAdvertiseTimeCvar register_cvar"deathrun_advertise_time""7.0" );
    
gInvisPercent register_cvar"deathrun_invisibility_percentage""111" );
    
gSuiciderPointsCvar register_cvar"deathrun_suicider_loose_points""3" );
    
gLongJumpTime register_cvar"deathrun_longjump_duration""6" );
    
gLongJumpCost register_cvar"deathrun_longjump_cost""46" );
    
gGlowCost register_cvar"deathrun_glow_cost""8" );
    
gNvgCost register_cvar"deathrun_nvg_cost""33" );
    
    
/* --| Let's find/do some stuff here */
    
gMsgItemPickup get_user_msgid"ItemPickup" );
    
gMessageNVG get_user_msgid"NVGToggle" );
    
    
/* --| Register the multilingual file */
    
register_dictionary"DeathrunShopLang.txt" );
}

/* --| Precache stuff */
public plugin_precache()
{
    
gJetSprite precache_model"sprites/explode1.spr" );
    
precache_soundPICKUP_SND );
    
precache_soundHEALTH_SOUND );
    
precache_soundARMOR_SOUND );
    
precache_soundCLOACK_SOUND );
    
precache_soundLJ_SOUND );
}

/* --| Plugin cfg, here we do some ugly shit ever -.- */
public plugin_cfg()
{
    new 
iCfgDir32 ], iFile192 ];
    
    
/* --| We need to find the configs directory, and to add the configuration file */
    
get_configsdiriCfgDircharsmaxiCfgDir ) );
    
formatexiFilecharsmaxiFile ), "%s/DeathrunShop_Cfg.cfg"iCfgDir );
    
    
/* --| If file not exists, let's create one but empty */
    
if( !file_existsiFile ) )
    {
        
server_print"[DrShop] %L"LANG_SERVER"DRSHOP_SVPRINT"iFile );
        
write_fileiFile" ", -);
    }
    
    
/* --| Else, let's load the cvars from cfg */
    
else
    {        
        
server_print"[DrShop] %L"LANG_SERVER"DRSHOP_SVPRINT_DONE"iFile );
        
server_cmd"exec %s"iFile );
    }
    
    
/* --| Set the server maxspeed to a high value, need it for speed item */
    
server_cmd"sv_maxspeed 99999999.0" );
}

/* --| When client is connecting, let's reset stuff and load client's points */
public client_connectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;
    
}

/* --| When client has disconnected let's reset stuff and save points */
public client_disconnectid )
{
    
HasHeid ] = false;
    
HasBothGrenid ] = false;
    
HasSilentid ] = false;
    
HasHealthid ] = false;
    
HasArmorid] = false;
    
HasSpeedid ] = false;
    
HasGravityid ] = false;
    
HasInvisid ] = false;
    
HasNoclipid ] = false;
    
HasJetid ] = false;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
HasGlowid ] = false;
    
HasNVGid ] = false;
}

/* --| When client has entered on sv, need to show him a hudmessage :) */
public client_putinserverid )
{
    if( 
get_pcvar_numgAdvertiseCvar ) != )
    {
        
/* --| Need to set task, 7 default because need to wait for player choosing a team or something */
        
set_taskget_pcvar_floatgAdvertiseTimeCvar ), "ShowPlayerInfo"id );
    }
}

/* --| Deathrun shop menu with items ^^ */
public DeathrunShopid )
{
    
/* --| If cvar is set to 0, player can't open the shop */
    
if( get_pcvar_numgDrShopOn ) != )
    {
        
client_printidprint_chat"[DrShop] %L"id"DRSHOP_DISABLED" );
        return 
PLUGIN_HANDLED;
    }
    
    
/* --| If player is dead, cant buy items :) */
    
if( !is_user_aliveid ) )
    {
        
client_printidprint_chat"[DrShop] %L"id"DRSHOP_ONLY_ALIVE" );
        return 
PLUGIN_HANDLED;
    }
    
    
/* --| Menu stuff */
    
new szText555 char ];
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_MENU_TITLE"VERSIONfm_get_user_cash(id) );
    
    new 
menu menu_createszText"shop_handler" );
    
    
/* --| Menu item 1 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_1"get_pcvar_numgHeCost ) );
    
menu_additemmenuszText"1");
    
    
/* --| Menu item 2 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_2"get_pcvar_numgBothGrenadesCost ) );
    
menu_additemmenuszText"2");
    
    
/* --| Menu item 3 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_3"get_pcvar_numgSilentCost ) );
    
menu_additemmenuszText"3");
    
    
/* --| Menu item 4 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_4"get_pcvar_numgHealthPointCvar ), get_pcvar_numgHealthCost ) );
    
menu_additemmenuszText"4");
    
    
/* --| Menu item 5 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_5"get_pcvar_numgArmorPointCvar ), get_pcvar_numgArmorCost ) );
    
menu_additemmenuszText"5");
    
    
/* --| Menu item 6 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_6"get_pcvar_numgSpeedCost ) );
    
menu_additemmenuszText"6");
    
    
/* --| Menu item 7 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_7"get_pcvar_numgGravityCost ) );
    
menu_additemmenuszText"7");
    
    
/* --| Menu item 8 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_8"get_pcvar_numgInvisPercent ), get_pcvar_numgInvisCost ) );
    
menu_additemmenuszText"8");
    
    
/* --| Menu item 9 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_9"get_pcvar_numgNoclipTime ), get_pcvar_numgNoclipCost ) );
    
menu_additemmenuszText"9");
    
    
/* --| Menu item 10 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_10"get_pcvar_numgJetTime ), get_pcvar_numgJetPackCost ) );
    
menu_additemmenuszText"10");
    
    
/* --| Menu item 11 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_11"get_pcvar_numgDeagleCost ) );
    
menu_additemmenuszText"11");
    
    
/* --| Menu item 12 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_12"get_pcvar_numgLongJumpTime ), get_pcvar_numgLongJumpCost ) );
    
menu_additemmenuszText"12");
    
    
/* --| Menu item 13 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_13"get_pcvar_numgGlowCost ) );
    
menu_additemmenuszText"13");
    
    
/* --| Menu item 14 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_14"get_pcvar_numgNvgCost ) );
    
menu_additemmenuszText"14");
    
    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
    
/* --| Show the menu, with current page 0 */
    
menu_displayidmenu);
    
    return 
PLUGIN_CONTINUE;
}

/* --| Menu commands */
public shop_handleridmenuitem )
{
    
/* --| If key is 0, let's close the menu */
    
if( item == MENU_EXIT )
    {
        
menu_destroymenu );
        return 
PLUGIN_HANDLED;
    }
    
    
/* --| Getting the menu information */
    
new data], iName64 ], accesscallback;
    
menu_item_getinfomenuitemaccessdatacharsmaxdata ), iNamecharsmaxiName ), callback );
    
    
/* --| Get menu keys */
    
new key str_to_numdata );
    
    
/* --| Here we find the player points */
    
new points fm_get_user_cash(id);
    
    switch( 
key )
    {
        
/* --| Menu item 1 */
        
case 1:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasHeid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgHeCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */
            
give_itemid"weapon_hegrenade" );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_GRENADE_ITEM" );
            
HasHeid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgHeCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 2 */
        
case 2:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasBothGrenid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgBothGrenadesCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */
            
give_itemid"weapon_hegrenade" );
            
give_itemid"weapon_flashbang" );
            
give_itemid"weapon_flashbang" );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_BOTHGREN_ITEM" );
            
HasBothGrenid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgBothGrenadesCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 3 */
        
case 3:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasSilentid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgSilentCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }    
            
            
/* --| Let's give the item, and do some stuff */
            
set_user_footstepsid);
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_SILENTWALK_ITEM" );
            
HasSilentid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgSilentCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 4 */
        
case 4:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasHealthid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgHealthCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_healthidget_user_healthid ) + get_pcvar_numgHealthPointCvar ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_HEALTH_ITEM"get_pcvar_numgHealthPointCvar ) );
            
HasHealthid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgHealthCost ));
            
emit_soundidCHAN_ITEMHEALTH_SOUNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 5 */
        
case 5:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasArmorid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgArmorCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_armoridget_user_armorid ) + get_pcvar_numgArmorPointCvar ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_ARMOR_ITEM"get_pcvar_numgArmorPointCvar ) );    
            
HasArmorid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgArmorCost ));
            
emit_soundidCHAN_ITEMARMOR_SOUNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 6 */
        
case 6:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasSpeedid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgSpeedCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_maxspeedidget_pcvar_floatgSpeedCvar ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_SPEED_ITEM" );
            
HasSpeedid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgSpeedCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 7 */
        
case 7:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasGravityid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgGravityCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_gravityidget_pcvar_floatgGravityCvar ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_GRAVITY_ITEM" );
            
HasGravityid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgGravityCost));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 8 */
        
case 8:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasInvisid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgInvisCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_renderingidkRenderFxNone000kRenderTransAlphaget_pcvar_numgInvisPercent ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_INVISIBILITY_ITEM" );
            
HasInvisid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgInvisCost ));
            
emit_soundidCHAN_ITEMCLOACK_SOUNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 9 */
        
case 9:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasNoclipid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgNoclipCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_taskfloatget_pcvar_numgNoclipTime ) ), "remove_noclip"id );
            
set_user_noclipid);
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_NOCLIP_ITEM" );
            
HasNoclipid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgNoclipCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 10 */
        
case 10:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasJetid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgJetPackCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_taskfloatget_pcvar_numgJetTime ) ), "remove_jetpack"id );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_JETPACK_ITEM" );
            
HasJetid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgJetPackCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 11 */
        
case 11:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasDeagleid ] || user_has_weaponidCSW_DEAGLE ) )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgDeagleCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
strip_user_weaponsid );
            
give_itemid"weapon_knife" );
            
give_itemid"weapon_deagle" );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_DEAGLE_ITEM" );
            
HasDeagleid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgDeagleCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 12 */
        
case 12:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasLongJumpid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgLongJumpCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            /* --| Setting the temporary long jump */
            
set_temporary_longjumpid );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_LJ_ITEM" );
            
HasLongJumpid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgLongJumpCost ));
            
emit_soundidCHAN_ITEMLJ_SOUNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 13 */
        
case 13:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasGlowid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgGlowCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_renderingidkRenderFxGlowShellrandom256 ), random256 ), random256 ), kRenderNormalrandom256 ) );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_GLOW_ITEM" );
            
HasGlowid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgGlowCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
        
        
/* --| Menu item 13 */
        
case 14:
        {
            
/* --| If already has item, show a damn print and return */
            
if( HasNVGid ] || get_user_nvgid ) )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| If player does not have enough points, show a print and return */
            
if( points get_pcvar_numgNvgCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
set_user_nvgid);
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_NVG_ITEM" );
            
HasNVGid ] = true;
            
            
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgNvgCost ));
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
    }
    
    return 
PLUGIN_HANDLED;
}
/* --| We need to find if player has performed a jump, and set some velocity */
public bacon_playerJumpingid )
{
    
/* --| If plugin is on, and user has jetpack item */
    
if( get_pcvar_numgDrShopOn ) != && HasJetid ] )
    {
        
/* --| Get user origins from feet */
        
new iOrigin];
        
get_user_originidiOrigin);
        
        
/* --| Modify origin a bit */
        
iOrigin] -= 20;
        
        
/* --| Get player velocity */
        
new Float:fVelocity];
        
pevidpev_velocityfVelocity );
        
        
/* --| Modify velocity a bit */
        
fVelocity] += 93;
        
        
/* --| Set the player velocity and add a flame effect, jetpack style */
        
set_pevidpev_velocityfVelocity );
        
create_flameiOrigin );
    }
}    

/* --| We need to check is player has changed his weapon */
public HookCurWeaponid )
{
    
/* --| If plugin is on, and user has speed item, let's set the speed again */
    
if( get_pcvar_numgDrShopOn ) != && HasSpeedid ] )
    {
        
set_user_maxspeedidget_pcvar_floatgSpeedCvar ) );
    }
}


/* --| Here we show player hud information about this god damn shop */
public ShowPlayerInfoid )
{
    
/* --| Set a hud message */
    
set_hudmessage00255, -1.00.8206.012.0 );
    
    
/* --| Now we show the info message in hud channel */
    
show_hudmessageid"%L"id"DRSHOP_HUD_INFO" );
}

/* --| If player has suicided by console */
public forward_killid )
{
    
/* --| Check if plugin is on, and user is alive */
    
if( get_pcvar_numgDrShopOn ) == && is_user_aliveid ) )
    {
        
/* --| Set player points with suicide cvar */
        
client_printidprint_chat"[DrShop] %L"id"DRSHOP_SHOW_LOOSER"get_pcvar_numgSuiciderPointsCvar ) );
        
fm_set_user_money(idfm_get_user_cash(id) - get_pcvar_numgSuiciderPointsCvar ));
    }
}

/* --| Event for round start */        
public logevent_round_start()
{
    
/* --| If plugin is on... */
    
if( get_pcvar_numgDrShopOn ) == )
    {
        
/* --| I used this native because with get_maxplayers will recieve a damn error with invalid player id.. */
        /* --| This is good because we can skip the damn bots */
        
new iPlayers32 ], iNumiid;
        
get_playersiPlayersiNum"c" );
        
        for( 
0iNumi++ )
        {
            
/* --| Find the index :) */
            
id iPlayers];
            
            
/* --| Reseting items */
            
HasHeid ] = false;
            
HasBothGrenid ] = false;
            
HasSilentid ] = false;
            
HasHealthid ] = false;
            
HasArmorid] = false;
            
HasSpeedid ] = false;
            
HasGravityid ] = false;
            
HasInvisid ] = false;
            
HasNoclipid ] = false;
            
HasJetid ] = false;
            
HasDeagleid ] = false;
            
HasLongJumpid ] = false;
            
HasGlowid ] = false;
            
HasNVGid ] = false;
            
            
set_user_gravityid1.0 );    
            
set_user_maxspeedid0.0 );
            
set_user_footstepsid);
            
set_user_noclipid);
            
set_user_renderingid );
            
set_user_nvgid);
            
remove_user_nvgid );
            
remove_taskid );
        }
    }
}

/* --| Event when player died */
public Hook_Deathmessage()
{
    
/* --| If plugin is on... */
    
if( get_pcvar_numgDrShopOn ) == )
    {
        
/* --| Get the killer and attacker */
        
new killer read_data);
        new 
victim read_data);
        
        
/* --| If player has died with world / trigger_hurt */
        
if( killer == victim )
        {
            return 
PLUGIN_HANDLED;
        }
        
        
        
/* --| Reseting items */
        
HasHevictim ] = false;
        
HasBothGrenvictim ] = false;
        
HasSilentvictim ] = false;
        
HasHealthvictim ] = false;
        
HasArmorvictim ] = false;
        
HasSpeedvictim ] = false;
        
HasGravityvictim ] = false;
        
HasInvisvictim ] = false;
        
HasNoclipvictim ] = false;
        
HasJetvictim ] = false;
        
HasDeaglevictim ] = false;
        
HasLongJumpvictim ] = false;
        
HasGlowvictim ] = false;
        
HasNVGvictim ] = false;
        
        
set_user_gravityvictim1.0 );    
        
set_user_maxspeedvictim0.0 );
        
set_user_footstepsvictim);
        
set_user_noclipvictim);
        
set_user_renderingvictim );
        
set_user_nvgvictim);
        
remove_user_nvgvictim );
        
remove_taskvictim );
    }
    
    return 
PLUGIN_CONTINUE;
}

/* --| Now we need to remove the noclip */
public remove_noclipid )
{
    
HasNoclipid ] = false;
    
set_user_noclipid);
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_NOCLIP_OFF"get_pcvar_numgNoclipTime ) );
}

/* --| Now we need to remove the jetpack */    
public remove_jetpackid )
{
    
HasJetid ] = false;
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_JETPACK_OFF"get_pcvar_numgJetTime ) );
}

/* --| Now we need to remove the longjump */
public remove_ljindex )
{
    
HasLongJumpindex ] = false;
    
engfuncEngFunc_SetPhysicsKeyValueindex"slj""0" );
    
client_printindexprint_chat"[DrShop] %L"index"DRSHOP_LJ_OFF"get_pcvar_numgLongJumpTime ) );
}

/* --| Usefull stocks on this plugin */
/* --| Display a message in chat if player already have the item */
stock allready_haveid )
{
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_ALLREADY_HAVE" );
}    

/* --| Display a message in chat if player don't have enough points */
stock dont_haveid )
{
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_DONTHAVE_POINTS" );
}    

/* --| Flame jetpack effect stock */
stock create_flameorigin] )
{
    
message_beginMSG_PVSSVC_TEMPENTITYorigin );
    
write_byteTE_SPRITE );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_coordorigin] );
    
write_shortgJetSprite );
    
write_byte);
    
write_byte99 );
    
message_end();
}

/* --| Setting temporary longjump stock */
stock set_temporary_longjumpindex )
{
    
/* --| Let's show to player the jetpack item on hud */
    
message_beginMSG_ONE_UNRELIABLEgMsgItemPickup_index );
    
write_string"item_longjump" );
    
message_end();
    
    
/* --| Setting the jetpack on */
    
engfuncEngFunc_SetPhysicsKeyValueindex"slj""1" );
    
    
/* --| Setting the time before jetpack will go off */
    
set_taskfloatget_pcvar_numgLongJumpTime ) ), "remove_lj"index );
}

/* --| Stock for setting user nightvision */
/* --| This stock is more good than cstrike native( give errors ) */
stock set_user_nvgindexnvgoggles )
{
    if( 
nvgoggles )
    {
        
set_pdata_intindexm_iNvgget_pdata_intindexm_iNvg ) | HAS_NVGS );
    }
    
    else
    {
        
set_pdata_intindexm_iNvgget_pdata_intindexm_iNvg ) & ~HAS_NVGS );
    }
}

/* --| Stock for removing turned on nightvision from players. Let's call, force remove nvg :) */ 
stock remove_user_nvgindex )
{
    new 
iNvgs get_pdata_intindexm_iNvgm_iLinuxDiff );
    
    if( !
iNvgs )
    {
        return;
    }
    
    if( 
iNvgs USES_NVGS )
    {
        
emit_soundindexCHAN_ITEMSOUND_NVGOFFVOL_NORMATTN_NORM0PITCH_NORM );
        
        
emessage_beginMSG_ONE_UNRELIABLEgMessageNVG_index );
        
ewrite_byte);
        
emessage_end();
    }
    
    
set_pdata_intindexm_iNvg0m_iLinuxDiff );
}  

/* --| Enf of plugin... */
public fm_set_user_money indexi_Money 

    
set_pdata_int index115i_Money ); 
    
    
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("Money"), _index);
    
write_long(i_Money); 
    
write_byte ); 
    
message_end (); 

__________________
Ex1ne is offline
 



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 07:42.


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