AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Need some help (https://forums.alliedmods.net/showthread.php?t=276725)

jgtyui 12-27-2015 06:30

Need some help
 
I have this plugin
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fun>
#include <hamsandwich>
#include <fakemeta_util>

#define PLUGIN "Vip wIN"
#define VERSION "1.0"
#define AUTHOR "c0stY*"



new gfi_WorkFile128 ];
new 
gs_VipsList128 ][ 32 ], gi_TotalLines;
new 
gi_IsUserVip33 ];
new 
g_pVisiblity;

new const 
gs_VipsFile[ ] = "vips.ini";

enum
{
    
Primary 1
    
Secondary
    
Knife
    
Grenades
    
C4
};

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_concmd("say /powers""showAdmin"ADMIN_LEVEL_H"")
    
register_clcmd"say /vmenu","Powermenu"ADMIN_LEVEL_H )
 
        
g_pVisiblity register_cvar"km_invis""150" ); // 255 = vizibil total

}



public 
plugin_cfg ( )
{
    new 
fi_Dir64 ];
    
get_configsdir fi_Dircharsmax fi_Dir ) );
    
formatex gfi_WorkFilecharsmax gfi_WorkFile ), "%s/%s"fi_Dirgs_VipsFile );
    
    if ( ! 
file_exists gfi_WorkFile ) )
        
write_file gfi_WorkFile"; *VIP List*" );
    
    new 
s_Buffer192 ], i_Linei_Len;
    while ( ( 
i_Line read_file gfi_WorkFilei_Lines_Buffercharsmax s_Buffer ), i_Len ) ) )
    {
        if ( ! 
strlen s_Buffer ) || s_Buffer] == ';' || ( s_Buffer] == '/' && s_Buffer] == '/' ) )
            continue;
            
        
copy gs_VipsListgi_TotalLines++ ], 32s_Buffer );

    }
}


public 
client_putinserver id gi_IsUserVipid ] = 0;
public 
client_disconnect id gi_IsUserVipid ] = 0;

public 
Powermenuid )
 {
    if ( ! 
is_user_alive id ) )
        return 
PLUGIN_HANDLED
    
if ( ! is_user_vip id ) )
    {
        
gi_IsUserVipid ] = 0;
        return 
PLUGIN_HANDLED
    
}
    
    
gi_IsUserVipid ] = 1;
    
    new 
menu menu_create"\rPowers Menu:""menu_handler" );
    

    
    
menu_additemmenu"\yViata.""1")
    
menu_additemmenu"\yViteza.""2")
    
menu_additemmenu"\yGravitate.""3",)
    
menu_additemmenu"\yAk47 +\wM4a1 + \yDeagle""4",)
    
menu_additemmenu"\yRifles \w[Arme \ytari].""5",)
    
menu_additemmenu"\yShiels.""6",)
    
menu_additemmenu"\yPachet grenazi.""7",)
    
menu_additemmenu"\yMachine Guns \w[5.9]""8",)
    
menu_additemmenu"\yViteza normala.""9",)
    
menu_additemmenu"\yArmura." "10",0)

    
menu_setpropmenuMPROP_EXITMEXIT_ALL );
    
menu_displayidmenu);
    
    return 
PLUGIN_HANDLED   
 
}

public 
menu_handleridmenuitem )
 {
    
    switch( 
item )
    {
        case 
0:
        {
        
set_user_health(id,800)
        
        }
        case 
1:
        {
                
set_pevid,pev_maxspeed1200.0)        
                
client_cmd(id,"cl_forwardspeed 1200.0")
                
client_cmd(id,"cl_backspeed 1200.0")                
                
client_cmd(id,"cl_sidespeed 1200.0")
        }
        case 
2:
        {
                
set_pevidpev_gravity0.3125);
        
        }
        case 
3:
        {
                
StripWeapons(idPrimary)
        
give_item(id,"weapon_ak47")
        
cs_set_user_bpammo(idCSW_AK47250);
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_m4a1")
        
cs_set_user_bpammo(idCSW_M4A1250 );
                
StripWeapons(idSecondary);
        
give_item(id,"weapon_deagle"
        
cs_set_user_bpammo(idCSW_DEAGLE250 );
        }
        case 
4:
        {
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_ak47")
        
cs_set_user_bpammo(idCSW_AK47250);
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_m4a1")
        
cs_set_user_bpammo(idCSW_M4A1250 );
                
StripWeapons(idSecondary)
        
give_item(id,"weapon_deagle"
        
cs_set_user_bpammo(idCSW_DEAGLE250 );
                
StripWeapons(id,Primary)
                
give_item(id,"weapon_famas")
                
cs_set_user_bpammo(idCSW_FAMAS250 );
                
StripWeapons(idPrimary)
        
give_item(id,"weapon_awp")
        
cs_set_user_bpammo(idCSW_AWP250 );
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_mp5navy")
        
cs_set_user_bpammo(idCSW_MP5NAVY250 );
                
StripWeapons(idSecondary)
        
give_item(id,"weapon_ump45"
        
cs_set_user_bpammo(idCSW_UMP45250 );
                
StripWeapons(idPrimary)
        
give_item(id,"weapon_galil")
        
cs_set_user_bpammo(idCSW_GALIL250 );
                
StripWeapons(idSecondary)
        
give_item(id,"weapon_scout"
        
cs_set_user_bpammo(idCSW_SCOUT250 );
                
StripWeapons(idPrimary)
        
give_item(id,"weapon_aug")
        
cs_set_user_bpammo(idCSW_AUG250 );
                
StripWeapons(idPrimary)
        
give_item(id,"weapon_sg550")
        
cs_set_user_bpammo(idCSW_SG550250 );
        }
        case 
5:
        {
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_shield")
        
        }
        case 
6:
        {
        
give_item(id"weapon_hegrenade")
                
cs_set_user_bpammo(idCSW_HEGRENADE10 );
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_flashbang")
        
give_item(id"weapon_smokegrenade")
                
cs_set_user_bpammo(idCSW_SMOKEGRENADE10 );
        }
        case 
7:
        {
        
StripWeapons(idPrimary)
        
give_item(id,"weapon_m249")
        
cs_set_user_bpammo(idCSW_M249300 );
                
        }
        case 
8:
        {
        
set_pevid,pev_maxspeed350.0)        
                
client_cmd(id,"cl_forwardspeed 350.0")             
                
client_cmd(id,"cl_backspeed 350.0")            
                
client_cmd(id,"cl_sidespeed 350.0")
        }
        case 
9:
        {
        
set_user_armor(id,800)
                
set_user_renderingidkRenderFxNone000kRenderTransAlphaget_pcvar_numg_pVisiblity ) );
        }
    }


    
menu_destroymenu );
    return 
PLUGIN_HANDLED;
}
 

public 
showAdmin(id)
{    
        new 
numiLenadmin
        
static pl[32], name[32], szBuff[2048]
    
        
get_players(plnum"c")
    
        for(new 
0numi++)
        {
            if (  
is_user_vip pl[i] ) )
            {
            
gi_IsUserVippl[i] ] = 1;
            
get_user_name(pl[i], name31)
            
iLen += format(szBuff[iLen], 2048 iLen"%d. %s^n"admin 1name)
            
admin++
            }
            
        }

    
        
set_hudmessage(025500.020.206.07.0 )
        
show_hudmessage(id" %s online:^n%s"admin "Vips" "Vips"szBuff)
    
        
arrayset(szBuff02048)
    
        return 
PLUGIN_HANDLED
}

//========================================================================================

stock is_user_vip id )
{
    new 
s_Name32 ], s_AuthID32 ];
    
get_user_name ids_Name31 );
    
get_user_authid ids_AuthID31 );
    
    for ( new 
igi_TotalLinesi++ )
    {
        if ( ! 
strcmp s_Namegs_VipsList] ) )
            return 
1;
        if ( ! 
strcmp s_AuthIDgs_VipsList] ) )
            return 
1;
    }
    
    return 
0;

}

stock StripWeapons(idTypeboolbSwitchIfActive true)
{
    new 
iReturn;
    
    if(
is_user_alive(id))
    {
        new 
iEntityiWeapon;
        while((
iWeapon GetWeaponFromSlot(idTypeiEntity)) > 0)
            
iReturn ham_strip_user_weapon(idiWeaponTypebSwitchIfActive);
    }
    
    return 
iReturn;
}

stock GetWeaponFromSlotid iSlot , &iEntity )
{
    if ( !( 
<= iSlot <= ) )
        return 
0;
    
    
iEntity 0;
    const 
m_rgpPlayerItems_Slot0 367;
    const 
m_iId 43;
    const 
XO_WEAPONS 4;
    const 
XO_PLAYER 5;
        
    
iEntity get_pdata_cbaseid m_rgpPlayerItems_Slot0 iSlot XO_PLAYER );
    
    return ( 
iEntity ) ? get_pdata_intiEntity m_iId XO_WEAPONS ) : 0;
}  

stock ham_strip_user_weapon(idiCswIdiSlot 0bool:bSwitchIfActive true)
{
    new 
iWeapon
    
if( !iSlot )
    {
        static const 
iWeaponsSlots[] = {
            -
1,
            
2//CSW_P228
            
-1,
            
1//CSW_SCOUT
            
4//CSW_HEGRENADE
            
1//CSW_XM1014
            
5//CSW_C4
            
1//CSW_MAC10
            
1//CSW_AUG
            
4//CSW_SMOKEGRENADE
            
2//CSW_ELITE
            
2//CSW_FIVESEVEN
            
1//CSW_UMP45
            
1//CSW_SG550
            
1//CSW_GALIL
            
1//CSW_FAMAS
            
2//CSW_USP
            
2//CSW_GLOCK18
            
1//CSW_AWP
            
1//CSW_MP5NAVY
            
1//CSW_M249
            
1//CSW_M3
            
1//CSW_M4A1
            
1//CSW_TMP
            
1//CSW_G3SG1
            
4//CSW_FLASHBANG
            
2//CSW_DEAGLE
            
1//CSW_SG552
            
1//CSW_AK47
            
3//CSW_KNIFE
            
//CSW_P90
        
}
        
iSlot iWeaponsSlots[iCswId]
    }

    const 
XTRA_OFS_PLAYER 5
    
const m_rgpPlayerItems_Slot0 367

    iWeapon 
get_pdata_cbase(idm_rgpPlayerItems_Slot0 iSlotXTRA_OFS_PLAYER)

    const 
XTRA_OFS_WEAPON 4
    
const m_pNext 42
    
const m_iId 43

    
while( iWeapon )
    {
        if( 
get_pdata_int(iWeaponm_iIdXTRA_OFS_WEAPON) == iCswId )
        {
            break
        }
        
iWeapon get_pdata_cbase(iWeaponm_pNextXTRA_OFS_WEAPON)
    }

    if( 
iWeapon )
    {
        const 
m_pActiveItem 373
        
if( bSwitchIfActive && get_pdata_cbase(idm_pActiveItemXTRA_OFS_PLAYER) == iWeapon )
        {
            
ExecuteHamB(Ham_Weapon_RetireWeaponiWeapon)
        }

        if( 
ExecuteHamB(Ham_RemovePlayerItemidiWeapon) )
        {
            
user_has_weapon(idiCswId0)
            
ExecuteHamB(Ham_Item_KilliWeapon)
            return 
1
        
}
    }

    return 
0


But when I chose to give me guns they give me only m4a1 and deagle not ak47 and when I chose rifles it give me only awp.I have an deathrun server and I found the problem it is because of hamdata.ini, I found a good hamdata and it works all weapons when I choose them but then it wont give me USP when the round starts.

siriusmd99 12-27-2015 18:08

Re: Need some help
 
First of all check if problem with usp is from code. Deactivate plugin and see if usp is given , if not then get the original hamdata.ini file.

addons_zz 12-27-2015 19:14

Re: Need some help
 
Sorry, this is not all the help you need, but it is some help:

See the sticky Use descriptive topic names and also get to know the stickies.


All times are GMT -4. The time now is 18:16.

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