AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Problem with DeathRun Shop (https://forums.alliedmods.net/showthread.php?t=242757)

beasTez2 06-24-2014 07:47

Problem with DeathRun Shop
 
Hello everyone :) I have a bug in DeathRun Shop plugin. Can anyone fix it?

Code:

L 07/19/2011 - 01:53:20: Start of error session.
L 07/19/2011 - 01:53:20: Info (map "deathrun_poolday_final") (file "addons/amxmodx/logs/error_20110719.log")
L 07/19/2011 - 01:53:20: [FUN] Invalid player 10
L 07/19/2011 - 01:53:20: [AMXX] Displaying debug trace (plugin "Deathrun_Shop.amxx", version "Ninja Edition")
L 07/19/2011 - 01:53:20: [AMXX] Run time error 10: native error (native "set_user_rendering")
L 07/19/2011 - 01:53:20: [AMXX]    [0] Deathrun_Shop.sma::Remove_Rendering (line 905)

PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <fun>
#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 ADMIN_ACCESS_CMD    ADMIN_KICK    
#define OFFSET_MONEY        115

/* --| Plugin informations */
new const PLUGIN[]     = "Deathrun Shop";
new const 
VERSION[]     = "Ninja Edition";
new const 
AUTHOR[]     = "tuty/other";
 
/* --| 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 
gDeagleCost;
new 
gMsgItemPickup;
new 
gLongJumpTime;
new 
gLongJumpCost;
new 
gMsgMoney;
new 
g_ADSpr;
new 
gEffectType;

/* --| Item variables */
new HasHe33 ];
new 
HasBothGren33 ];
new 
HasSilent33 ];
new 
HasHealth33 ];
new 
HasArmor33 ];
new 
HasSpeed33 ];
new 
HasGravity33 ];
new 
HasInvis33 ];
new 
HasDeagle33 ];
new 
HasLongJump33 ];
new 
gName32 char ];
new 
g_b_Invisible33 ];

/* --| 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" );
    
    
/* --| Command for setting money to player/@all */
    
register_concmd"deathrun_set_money""cmdSetMoney"ADMIN_ACCESS_CMD"<name/@all> <money> - set money to a player" );
    
    
/* --| Command for reseting money to palyer/@all */
    
register_concmd"deathrun_reset_money""cmdResetMoney"ADMIN_ACCESS_CMD"<name/@all> - reset player money" );
    
    
/* --| Command for opening the menu */
    
register_clcmd"say /drshop""DeathrunShop" );
    
register_clcmd"say_team /drshop""DeathrunShop" );
    
register_clcmd"/shop""DeathrunShop" );
    
    
/* --| Command to see our points :) */
    
register_clcmd"say /money""ShowPoints" );
    
register_clcmd"say_team /money""ShowPoints" );
    
register_clcmd"/money""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""3000" ); 
    
gBothGrenadesCost register_cvar"deathrun_bothgrenades_cost""4000" );
    
gSilentCost register_cvar"deathrun_silent_cost""4000" );
    
gHealthCost register_cvar"deathrun_health_cost""4000" );
    
gArmorCost register_cvar"deathrun_armor_cost""4000" );
    
gSpeedCost register_cvar"deathrun_speed_cost""8000" );
    
gGravityCost register_cvar"deathrun_gravity_cost""8000" );
    
gInvisCost register_cvar"deathrun_invisibility_cost""16000" );
    
gSpeedCvar register_cvar"deathrun_speed_power""400.0" );
    
gDeagleCost register_cvar"deathrun_deagle_cost""16000" );
    
gGravityCvar register_cvar"deathrun_gravity_power""0.5" );
    
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""0" );
    
gLongJumpTime register_cvar"deathrun_longjump_duration""8" );
    
gLongJumpCost register_cvar"deathrun_longjump_cost""10000" );
    
gEffectType register_cvar"deathrun_effect_type""3" );

    
/* --| Let's find/do some stuff here */
    
gMsgItemPickup get_user_msgid"ItemPickup" );
    
gMsgMoney get_user_msgid"Money" );
    
    
/* --| Register the multilingual file */
    
register_dictionary"DeathrunShopLang.txt" );
}

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

/* --| 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;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
g_b_Invisibleid ] = 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;
    
HasDeagleid ] = false;
    
HasLongJumpid ] = false;
    
g_b_Invisibleid ] = 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_money(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 */
    /* formatex( szText, charsmax( szText ), "%L", id, "DRSHOP_ITEM_8", get_pcvar_num( gInvisPercent ), get_pcvar_num( gInvisCost ) ); */
    
    
if(get_pdata_int(id114) == 1)
    {
        
formatex(szTextcharsmax(szText), "\w%d%% from 255 Invisible \r(Only Terrorist) \w- \y%d$",
            
get_pcvar_num(gInvisPercent), get_pcvar_num(gInvisCost));
    }
    else
    {
        
formatex(szTextcharsmax(szText), "\d%d%% from 255 Invisible (Only Terrorist) - %d$",
            
get_pcvar_num(gInvisPercent), get_pcvar_num(gInvisCost));
    }
    
    
menu_additemmenuszText"8");
    
    
/* --| Menu item 9 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_9"get_pcvar_numgDeagleCost ) );
    
menu_additemmenuszText"9");
    
    
/* --| Menu item 10 */
    
formatexszTextcharsmaxszText ), "%L"id"DRSHOP_ITEM_10"get_pcvar_numgLongJumpTime ), get_pcvar_numgLongJumpCost ) );
    
menu_additemmenuszText"10");
    
    
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 money fm_get_user_money(id); 
    
    static 
Float:originF[3];
    
pev(idpev_originoriginF);
    
    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( money get_pcvar_numgHeCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gHeCost));
            
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( money get_pcvar_numgBothGrenadesCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| Let's give the item, and do some stuff */
            
give_itemid"weapon_flashbang" );
            
give_itemid"weapon_smokegrenade" );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_BOTHGREN_ITEM" );
            
HasBothGrenid ] = true;
            
            
fm_set_user_money(idmoney get_pcvar_num(gBothGrenadesCost));
            
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( money get_pcvar_numgSilentCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }    
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gSilentCost));
            
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( money get_pcvar_numgHealthCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gHealthCost));
            
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( money get_pcvar_numgArmorCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gArmorCost));
            
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( money get_pcvar_numgSpeedCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gSpeedCost));
            
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( money get_pcvar_numgGravityCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gGravityCost));
            
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( 
get_user_teamid ) == )
            {
                
client_printidprint_chat"[DrShop] %L"id"DRSHOP_ONLY_T" );
                
menu_display(idmenu1);
                return 
PLUGIN_HANDLED;
            }
        
            
/* --| If player does not have enough points, show a print and return */
            
if( money get_pcvar_numgInvisCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering_Invisible"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering_Invisible"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_INVISIBILITY_ITEM" );
            
HasInvisid ] = true;
            
g_b_Invisibleid ] = true;
            
            
fm_set_user_money(idmoney get_pcvar_num(gInvisCost));
            
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( HasDeagleid ] || user_has_weaponidCSW_DEAGLE ) )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
        
            
/* --| If player does not have enough points, show a print and return */
            
if( money get_pcvar_numgDeagleCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| Let's give the item, and do some stuff */ 
            
give_itemid"weapon_deagle" );
            
            
client_printidprint_chat"[DrShop] %L"id"DRSHOP_DEAGLE_ITEM" );
            
HasDeagleid ] = true;
            
            
fm_set_user_money(idmoney get_pcvar_num(gDeagleCost));
            
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( HasLongJumpid ] )
            {
                
allready_haveid );
                return 
PLUGIN_HANDLED;
            }
        
            
/* --| If player does not have enough points, show a print and return */
            
if( money get_pcvar_numgLongJumpCost ) )
            {
                
dont_haveid );
                return 
PLUGIN_HANDLED;
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {

                
Effects(originF);
                
screen_fade(id110255050);
            }
            
            if( 
get_pcvar_numgEffectType ) == )
            {
                if( !
g_b_Invisibleid ] )
                {
                    
set_user_renderingidkRenderFxGlowShell02550kRenderTransAlpha16 );
                    
set_task(2.0"Remove_Rendering"id);
                }
                
                
screen_fade(id110255050);
                
Effects(originF);
            }
            
            
/* --| 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(idmoney get_pcvar_num(gLongJumpCost));
            
emit_soundidCHAN_ITEMLJ_SOUNDVOL_NORM ATTN_NORM PITCH_NORM );
            
menu_displayidmenu);
        }
    }
    
    return 
PLUGIN_HANDLED;
}

public 
Remove_Renderingid )
{
    
set_user_renderingidkRenderFxGlowShell000kRenderNormal16 );
}

public 
Remove_Rendering_Invisibleid )
{
    
set_user_renderingidkRenderFxNone000kRenderTransAlphaget_pcvar_numgInvisPercent ) );
}

/* --| Command for setting points | admin only ;/ */
public cmdSetMoneyidlevelcid )
{
    
/* --| 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 */
            
new i_Money;
            
i_Money fm_get_user_money(all); 
            
fm_set_user_money(alli_Money 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 */
        
new i_Money;
        
i_Money fm_get_user_money(player); 
        
fm_set_user_money(playeri_Money gift);
        
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOW_CMD"gNamegiftTargetName );
    }

    return 
PLUGIN_HANDLED;
}

/* --| Command for reseting points | admin only ;/ */
public cmdResetMoneyidlevelcid )
{
    
/* --| 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 */
            
fm_set_user_money(all01); 
            
            
/* --| 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 */
        
fm_set_user_money(player01);
        
client_print0print_chat"[DrShop] %L"LANG_PLAYER"DRSHOP_SHOWRESET_CMD"gNameTargetName );
    }

    return 
PLUGIN_HANDLED;
}

/* --| 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_MONEY_INFO"fm_get_user_money(id) );
    
    
/* --| We show player points on chat */
    
client_printidprint_chat"[DrShop] %L"id"DRSHOP_MONEY_INFO"fm_get_user_money(id) );
    
    return 
PLUGIN_CONTINUE;
}

/* --| Here we show player hud information about this god damn shop */
public ShowPlayerInfoid )
{
    
/* --| Set a hud message */
    
set_hudmessage0189255, -1.00.8206.012.0 );
    
    
/* --| Now we show the info message in hud channel */
    
show_hudmessageid"%L"id"DRSHOP_HUD_INFO" );
}
/* --| 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;
            
HasDeagleid ] = false;
            
HasLongJumpid ] = false;
            
            
set_user_gravityid1.0 );    
            
set_user_maxspeedid0.0 );
            
set_user_footstepsid);
            
set_user_renderingid );
            
remove_taskid );
        }
    }
}

/* --| Event when player died */
public Hook_Deathmessage()
{
    
/* --| If plugin is on... */
    
if( get_pcvar_numgDrShopOn ) == )
    {
        
/* --| Get the killer and attacker */
        
new victim read_data);

        
/* --| If player has died with world / trigger_hurt */
        
if(!(<= victim <= 32) || read_data(1) == victim)
        {
            return 
PLUGIN_HANDLED;
        }
        
        
/* --| Reseting items */
        
HasHevictim ] = false;
        
HasBothGrenvictim ] = false;
        
HasSilentvictim ] = false;
        
HasHealthvictim ] = false;
        
HasArmorvictim ] = false;
        
HasSpeedvictim ] = false;
        
HasGravityvictim ] = false;
        
HasInvisvictim ] = false;
        
HasDeaglevictim ] = false;
        
HasLongJumpvictim ] = false;
        
        
set_user_gravityvictim1.0 );    
        
set_user_maxspeedvictim0.0 );
        
set_user_footstepsvictim);
        
set_user_renderingvictim );
        
remove_taskvictim );
    }
    
    return 
PLUGIN_CONTINUE;
}
/* --| 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_MONEY" );
}    

/* --| 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 fm_get_user_moneyindex )
{
    new 
money get_pdata_intindexOFFSET_MONEY );
    return 
money;
}

stock fm_set_user_moneyindexmoneyflash )
{
    
set_pdata_intindexOFFSET_MONEYmoney );
    
fm_set_moneyindexmoneyflash );
    return 
1;
}
stock fm_set_moneyindexmoneyflash )
{
    
message_beginMSG_ONE_UNRELIABLEgMsgMoney, {000}, index );
    
write_longmoney );
    
write_byteflash );
    
message_end();
}
stock screen_fade(indexiDurationiHoldTimergbalpha)
{
    
message_begin(MSG_ONEget_user_msgid("ScreenFade"), {0,0,0}, index );
    
write_short(fade_units_to_seconds(iDuration));
    
write_short(fade_units_to_seconds(iHoldTime));
    
write_short(0x0000);
    
write_byte(r);
    
write_byte(g);
    
write_byte(b);
    
write_byte(alpha); 
    
message_end();
}
stock fade_units_to_seconds(num)
{
    return ((
1<<12) * (num));
}

Effects(const Float:originF3[3])
{
    
// Largest ring
    
engfuncEngFunc_MessageBeginMSG_PVSSVC_TEMPENTITYoriginF3);
    
write_byteTE_BEAMCYLINDER ); // TE id
    
engfuncEngFunc_WriteCoordoriginF3[0] ); // x
    
engfuncEngFunc_WriteCoordoriginF3[1] ); // y
    
engfuncEngFunc_WriteCoordoriginF3[2] ); // z
    
engfuncEngFunc_WriteCoordoriginF3[0] ); // x axis
    
engfuncEngFunc_WriteCoordoriginF3[1] ); // y axis
    
engfuncEngFunc_WriteCoordoriginF3[2]+100.0 ); // z axis
    
write_shortg_ADSpr ); // sprite
    
write_byte); // startframe
    
write_byte); // framerate
    
write_byte); // life
    
write_byte60 ); // width
    
write_byte); // noise
    
write_byte); // red
    
write_byte255 ); // green
    
write_byte50 ); // blue
    
write_byte200 ); // brightness
    
write_byte); // speed
    
message_end();
}

/* --| Enf of plugin... */
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/ 


HamletEagle 06-24-2014 07:53

Re: Problem with DeathRun Shop
 
Post in plugin theard.

beasTez2 06-24-2014 08:04

Re: Problem with DeathRun Shop
 
This plugin has been edited by other person and because I've posted here.

Flick3rR 06-24-2014 08:32

Re: Problem with DeathRun Shop
 
Attach it as a .sma file, because this [PHP] tag has awful indenting... (Hate it). The error seams simple, like maybe some is_user_alive check, etc. And if you want someone to make it for you, you should post in Suggestions/Requests section.

beasTez2 06-24-2014 08:36

Re: Problem with DeathRun Shop
 
ok. I'll test with is_user_alive and if it don't work, I'll attack sma.


All times are GMT -4. The time now is 21:07.

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