Raised This Month: $ Target: $400
 0% 

Get weapon entity index when dropped


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Buckshot
Senior Member
Join Date: Mar 2014
Location: Sweden
Old 04-17-2014 , 22:24   Re: Get weapon entity index when dropped
Reply With Quote #4

Uhm.. This is making bugs that i've never seen before.. When i tried it, my screen like turned upside down.. or sideways :s.. I could walk around like that too.. Also i did not see my weapon. I'm suspecting there is something wrong with pev_health. When this happens, my health is set to 1, though i set health to 100 in the function. I noticed the value of "100" for pev_health that was wrong, and i changed it to a float value "100.0" from default "100", now i'm not even getting to the player menu.. This is really confusing. But.. the glow itself worked while my screen was twisted though


Here's a screenshot of it.
http://steamcommunity.com/sharedfile.../?id=250330790

Getting no error logs when debugging, or any errors compiling.


Plugin is not close to done.. i just started making it an hour ago, and all this happened when i ran it for the first time just to check that it was working as it should.. but here it is
PHP Code:
#include < amxmodx >
#include < fakemeta_util >
#include < cstrike >
#include < colorchat >

#define OFFSET_PRIMARYWEAPON    116 

#pragma semicolon 1

new const g_szPREFIX[ ] = "[AMXX]";

new 
pcvar_LastRequest;

new 
bool:Challenger32 ], bool:Challenged32 ];
new 
bool:g_bGame_S4Sbool:g_bGame_Guntossbool:g_bGame_Box;

public 
plugin_init() {
    
register_plugin"Last Request""1.0""BuckShot" );
    
    
pcvar_LastRequest register_cvar("jb_lastrequest""1");
    
    
register_clcmd"say /lr""Checks" );
    
    
register_forwardFM_SetModel"Fwd_SetModel");
}

public 
Checksid )
{
    if( 
get_pcvar_numpcvar_LastRequest ) != )
    {
        
set_pcvar_numpcvar_LastRequest);
        return 
PLUGIN_HANDLED;
    }
    
    if( 
cs_get_user_teamid ) != CS_TEAM_T )
    {
        
ColorChatidRED"%s^x01 You must be a prisoner in order to get a last request"g_szPREFIX );
        return 
PLUGIN_HANDLED;
    }
    
    new 
iPlayers32 ], iPlayeriPnum;
    new 
iCTcountiTcount;
    
    
get_playersiPlayersiPnum"a" );
    
    for( new 
0iPnumi++ )
    {
        
iPlayer iPlayers];
        switch( 
cs_get_user_teamiPlayer ) )
        {
            case 
CS_TEAM_CTiCTcount++;
            case 
CS_TEAM_TiTcount++;
        }
    }
    
    if( 
iTcount )
    {
        
ColorChatidRED"%s^x01 There are too many prisoners alive"g_szPREFIX );
        return 
PLUGIN_HANDLED;
    }
    
    if( 
iCTcount == )
    {
        
ColorChatidRED"%s^x01 There are no guards alive"g_szPREFIX );
        return 
PLUGIN_HANDLED;
    }
    
LastRequest_Menuid );
    return 
PLUGIN_HANDLED;
}

public 
LastRequest_Menuid )
{
    new 
iMenu menu_create"\yChoose your Last Request""LastRequest_Handler" );
    
    
menu_additemiMenu"\wShot for Shot""");
    
menu_additemiMenu"\wGun Toss""");
    
menu_additemiMenu"\wBoxing Match""");
    
    
menu_setpropiMenuMPROP_EXITMEXIT_ALL );
    
    
menu_displayidiMenu);
}

public 
LastRequest_HandleridiMenuiItem )
{
    if( 
iItem == MENU_EXIT )
    {
        
menu_destroyiMenu );
        return 
PLUGIN_HANDLED;
    }
    
    switch( 
iItem )
    {
        case 
0g_bGame_S4S true;
        case 
1g_bGame_Guntoss true;
        case 
2g_bGame_Box true;
    }
    
PlayerMenuid );
    return 
PLUGIN_HANDLED;
    
}

public 
PlayerMenuid )
{
    new 
iMenu menu_create"\yChoose your opponent:""Games_Handler" );
    
    new 
iPlayers32 ], iTempidiPnum;
    
    new 
szName32 ], szUserid32 ];
    
    
get_playersiPlayersiPnum"ae""CT" );
    
    for( new 
0iPnumi++ )
    {
        
iTempid iPlayers];
        
        
get_user_nameiTempidszNamecharsmaxszName ) );
        
        
formatexszUseridcharsmaxszUserid ), "%d"get_user_useridiTempid ) );
        
        
menu_additemiMenuszNameszUserid);
    }
    
    
menu_displayidiMenu);
}

public 
Games_HandleridiMenuiItem )
{
    if ( 
iItem == MENU_EXIT )
    {
        
menu_destroyiMenu );
        return 
PLUGIN_HANDLED;
    }
    
    new 
szData], szName64 ];
    new 
item_accessitem_callback;
    
    
menu_item_getinfoiMenuiItemitem_accessszDatacharsmaxszData ), szNamecharsmaxszName ), item_callback );
    
    new 
szUserid str_to_numszData );
    
    new 
iTempid find_player"k"szUserid );
    
    if( 
iTempid && is_user_aliveiTempid ) )
    {
        
Challengerid ] = true;
        
ChallengediTempid ] = true;
        
        new 
szName32 ], szName232 ];
        
get_user_nameidszNamecharsmaxszName ) );
        
get_user_nameiTempidszName2charsmaxszName2 ) );
        
        if( 
g_bGame_S4S )
        {
            
StripWeaponsid );
            
StripWeaponsiTempid );
            
            
set_pevidpev_health100.0 );
            
set_peviTempidpev_health100.0 );
            
            
fm_give_itemid"weapon_deagle" );
            
fm_give_itemiTempid"weapon_deagle" );
            
            
cs_set_user_bpammoidCSW_DEAGLE35 );
            
cs_set_user_bpammoiTempidCSW_DEAGLE35 );
            
            
ColorChatidRED"%s^x04 %s^x01 wants a Shot for Shot with^x04 %s"g_szPREFIXszNameszName2 );
        }
        
        else if( 
g_bGame_Guntoss )
        {
            
StripWeaponsid );
            
StripWeaponsiTempid );
            
            
set_pevidpev_health100.0 );
            
set_peviTempidpev_health100.0 );
            
            new 
Deagle_id fm_give_itemid"weapon_deagle" );
            new 
Deagle_tempid fm_give_itemiTempid"weapon_deagle" );
            
            
cs_set_weapon_ammoDeagle_id);
            
cs_set_weapon_ammoDeagle_tempid);
            
            
cs_set_user_bpammoidCSW_DEAGLE);
            
cs_set_user_bpammoiTempidCSW_DEAGLE);
            
            
ColorChatidRED"%s^x04 %s^x01 wants a Gun Toss with^x04 %s"g_szPREFIXszNameszName2 );
            
            
        }
        
        else if( 
g_bGame_Box )
        {
            
// Box code 
        
}
    }
    return 
PLUGIN_HANDLED;
}
/* All forwards, stocks and outside functions etc down here */

/* Deagle glow when in gun toss */
public Fwd_SetModeliEntity,const szModel[ ] )
{
    if( !
g_bGame_Guntoss )
        return 
FMRES_IGNORED;
    
    if( !
pev_validiEntity ) ) 
        return 
FMRES_IGNORED;
    
    new 
id;
    
id peviEntitypev_owner );
    
    if( 
Challengerid ] || Challengedid ] && is_user_aliveid ))
    {
        static 
iWeapon;
        
iWeapon get_user_weaponid );
        
        if( 
iWeapon == CSW_DEAGLE )
        {    
            new 
redblue;
            
            switch( 
cs_get_user_teamid ) )
            {
                
                case 
CS_TEAM_CTred 255;
                case 
CS_TEAM_Tblue 255;
            }
            
fm_set_renderingiEntitykRenderFxGlowShellred0bluekRenderNormal16 );
        }
    }
    
    return 
FMRES_SUPERCEDE;
}

/* Strip weps, give knife.. So i dont gotta repeat this process in every single lr menu option. */
stock StripWeaponsindex )
{
    
fm_strip_user_weaponsindex );
    
set_pdata_intindexOFFSET_PRIMARYWEAPON);
    
fm_give_itemindex"weapon_knife" );

Anyone knows what's creating this phenomenon that was twisting the whole game for me?
__________________
PM me for private work.



Last edited by Buckshot; 04-17-2014 at 23:30.
Buckshot is offline
Send a message via Skype™ to Buckshot
 



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 17:53.


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