Raised This Month: $ Target: $400
 0% 

[REQ]Deathrun Shop 4.0


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
stmservers
Junior Member
Join Date: May 2014
Location: Stamboliyski, Bulgaria
Old 05-04-2014 , 12:41   [REQ]Deathrun Shop 4.0
Reply With Quote #1

Hello dear friends !
I got Deathrun Shop 4.0 for my new server and my problem is that i want to disable some of the items in the shop. And when i say i want to disable them i mean that i don't want the items to appear in the shop when you enter it. I would be very thankful if you could remove the GLOW,NOCLIP,DEAGLE,ARMOR,Night Vision, Longjump and Jetpack from the shop !

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)

/* --| 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 
gKillerPointsCvar;
new 
gSuiciderPointsCvar;
new 
gSavePlayerPoints;
new 
gNoclipCost;
new 
gVault;
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 ];
new 
gName32 char ];
new 
gSteamID32 ];
new 
vKey64 ];
new 
vData64 ];

/* --| Player points, need this to save points, load points, etc */
new gKillerPoints33 ];

/* --| 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"DeathMsg""Hook_Deathmessage""a" );
    
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 setting points to player/@all */
    
register_concmd"deathrun_set_points""cmdSetPoints"ADMIN_ACCESS_CMD"<name/@all> <points> - set points to a player" );
    
    
/* --| Command for reseting points to palyer/@all */
    
register_concmd"deathrun_reset_points""cmdResetPoints"ADMIN_ACCESS_CMD"<name/@all> - reset player points" );
    
    
/* --| Command for opening the menu */
    
register_clcmd"say /drshop""DeathrunShop" );
    
register_clcmd"say_team /drshop""DeathrunShop" );
    
    
/* --| Command to see our points :) */
    
register_clcmd"say /mypoints""ShowPoints" );
    
register_clcmd"say_team /mypoints""ShowPoints" );

    
    
/* --| 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" );
    
gKillerPointsCvar register_cvar"deathrun_killer_bonuspoints""5" );
    
gSuiciderPointsCvar register_cvar"deathrun_suicider_loose_points""3" );
    
gSavePlayerPoints register_cvar"deathrun_save_points""1" );
    
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;
    
    
/* --| Load client points */
    
load_client_pointsid );
}

/* --| 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;
    
    
/* --| If player is not a bot, let's save the points */
    
if( get_pcvar_numgSavePlayerPoints ) != && !is_user_botid ) )
    {
        
/* --| Save player points is cvar is 1 */
        
save_client_pointsid );
    }
}

/* --| 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"VERSIONgKillerPointsid ] );
    
    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 gKillerPointsid ];
    
    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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= 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;
            
            
gKillerPointsid ] -= get_pcvar_numgNvgCost );
            
emit_soundidCHAN_ITEMPICKUP_SNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
    }
    
    return 
PLUGIN_HANDLED;
}

/* --| Command for setting points | admin only ;/ */
public cmdSetPointsidlevelcid )
{
    
/* --| If user doesn't have acces to command, return */
    
if( !cmd_accessidlevelcid) || !get_pcvar_numgDrShopOn ) )
    {
        return 
PLUGIN_HANDLED
    }
    
    
/* --| Need to read the first argument */
    
new argument32 ];
       
read_argv1argumentcharsmaxargument ) );

    
/* --| Need to read second argument */
    
new give_points];
    
read_argv2give_pointscharsmaxgive_points ) );

    
/* --| We are getting the gift from second argument */
    
new gift str_to_numgive_points );
    
    new 
iPlayer32 ], iNumall;
    
get_playersiPlayeriNum"c" );

    
/* --| Lets see if argument 1 is @all */
    
if( equalargument"@all" ) )
    {
        for( new 
iiNumi++ )
        {
            
/* --| Find the index :) */
            
all iPlayer];
            
            
/* --| Set points to all */
            
gKillerPointsall ] = gKillerPointsall ] + gift;
            
            
/* --| Show a print in chat */
            
get_user_nameidgNamecharsmaxgName ) );
            
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOW_ALLCMD"gNamegift );
        }
    }
            
    else
    {
        
/* --| Now, we find the target */
        
new player cmd_targetidargument10 );

        
/* --| If is not a valid target, return */
        
if( !player 
        {
               return 
PLUGIN_HANDLED;
        }
    

        
/* --| Get admin, and target name */
        
new TargetName32 char ];
        
get_user_nameplayerTargetNamecharsmaxTargetName ) );
        
get_user_nameidgNamecharsmaxgName ) );    
    
        
/* --| Setting target points */
        
gKillerPointsplayer ] = gKillerPointsplayer ] + gift;
        
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOW_CMD"gNamegiftTargetName );
    }

    return 
PLUGIN_HANDLED;
}

/* --| Command for reseting points | admin only ;/ */
public cmdResetPointsidlevelcid )
{
    
/* --| If user doesn't have acces to command, return */
    
if( !cmd_accessidlevelcid) || !get_pcvar_numgDrShopOn ) )
    {
        return 
PLUGIN_HANDLED
    }
    
    
/* --| Need to read the first argument */
    
new argument32 ];
       
read_argv1argumentcharsmaxargument ) );
    
    new 
iPlayer32 ], iNumall;
    
get_playersiPlayeriNum"c" );

    
/* --| Lets see if argument 1 is @all */
    
if( equalargument"@all" ) )
    {
        for( new 
iiNumi++ )
        {
            
/* --| Find the index :) */
            
all iPlayer];
            
            
/* --| Set points to all */
            
gKillerPointsall ] = 0;
            
            
/* --| Show a print in chat */
            
get_user_nameidgNamecharsmaxgName ) );
            
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOWRESET_ALLCMD"gName );
        }
    }
            
    else
    {
        
/* --| Now, we find the target */
        
new player cmd_targetidargument10 );

        
/* --| If is not a valid target, return */
        
if( !player 
        {
               return 
PLUGIN_HANDLED;
        }
    

        
/* --| Get admin, and target name */
        
new TargetName32 char ];
        
get_user_nameplayerTargetNamecharsmaxTargetName ) );
        
get_user_nameidgNamecharsmaxgName ) );    
    
        
/* --| Setting target points */
        
gKillerPointsplayer ] = 0;
        
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOWRESET_CMD"gNameTargetName );
    }

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

/* --| Command for show points */    
public ShowPointsid )
{
    
/* --| Set a hud message */
    
set_hudmessage255422120.030.8626.05.0 );
    
    
/* --| We show player points on hud */
    
show_hudmessageid"[DrShop] %L"id"DRSHOP_POINTS_INFO"gKillerPointsid ] );
    
    
/* --| We show player points on chat */
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_POINTS_INFO"gKillerPointsid ] );
    
    return 
PLUGIN_CONTINUE;
}

/* --| 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 ) );
        
gKillerPointsid ] -= 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;
        }
        
        
/* --| Setting killer points when killed a enemy */
        
gKillerPointskiller ] += get_pcvar_numgKillerPointsCvar );
    
        
/* --| 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" );
}    

/* --| Saving player points */
stock save_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
/* --| Get the player steamid */
    
get_user_authidindexgSteamIDcharsmaxgSteamID ) );
    
    
/* --| Setting stuff on vault file, and close the file */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"gSteamID );
    
formatexvDatacharsmaxvData ), "%d"gKillerPointsindex ] );
    
nvault_setgVaultvKeyvData );
    
nvault_closegVault );
}

/* --| Loading client points */
stock load_client_pointsindex )
{
    
/* --| Open the vault file */
    
gVault nvault_open"DeathrunShop_SavedPoints" );
    
    
/* --| If vault return -1, lets stop this shit */
    
if( gVault == INVALID_HANDLE )
    {
        
set_fail_state"[DrShop] nValut ERROR: =-> Invalid-Handle" );
    }
    
    
/* --| Get the player steamid */
    
get_user_authidindexgSteamIDcharsmaxgSteamID ) );
    
    
/* --| Get the player points, then, close the nvault vile */
    
formatexvKeycharsmaxvKey ), "%sPOINTS"gSteamID );
    
gKillerPointsindex ] = nvault_getgVaultvKey );
    
nvault_closegVault );
}

/* --| 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... */ 

Last edited by stmservers; 05-04-2014 at 12:47. Reason: I forgot the [PHP][/PHP] tag
stmservers is offline
Send a message via Skype™ to stmservers
 



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 19:39.


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