Raised This Month: $ Target: $400
 0% 

How to block the CS from give the default Glock/USP?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 03-29-2009 , 11:33   Re: How to block the CS from give the default Glock/USP?
Reply With Quote #5

Try this, should prevent to give weapons to a player that was dead when he spawn.

PHP Code:
/*    Copyright © 2009, ConnorMcLeod

    No Default Guns is free software;
    you can redistribute it and/or modify it under the terms of the
    GNU General Public License as published by the Free Software Foundation.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with No Default Guns; if not, write to the
    Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.
*/

#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#define PLUGIN "No Default Guns"
#define AUTHOR "ConnorMcLeod"
#define VERSION "0.0.1"

const GUNS_BITSUM = ((1<<CSW_P228)|(1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_DEAGLE))

#define MAX_PLAYERS 32

new g_bFirstSpawn[MAX_PLAYERS+1]
new 
g_bRestart[MAX_PLAYERS+1]
new 
g_bDontGiveGun[MAX_PLAYERS+1]

new 
g_bRestarting
new g_iMaxPlayers

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_event("TextMsg""Event_TextMsg_Restart""a""2&#Game_C""2&#Game_w")
    
register_event("HLTV""Event_HLTV_New_Round""a""1=0""2=0")

    
RegisterHam(Ham_Spawn"player""Player_Spawn_Pre")
    
RegisterHam(Ham_AddPlayerItem"player""Player_AddPlayerItem")

    
register_forward(FM_ClientPutInServer"ClientPutInServer")

    
g_iMaxPlayers get_maxplayers()
}

public 
ClientPutInServer(id)
{
    
g_bFirstSpawn[id] = true
    g_bRestart
[id] = false
}

public 
Event_TextMsg_Restart()
{
    
g_bRestarting true
}

public 
Event_HLTV_New_Round()
{
    if( 
g_bRestarting )
    {
        
g_bRestarting false
        
for(new id=1id<=g_iMaxPlayersid++)
        {
            if( 
is_user_alive(id) )
            {
                
g_bRestart[id] = true
            
}
        }
    }
}

public 
Player_Spawn_Pre(id)
{
    if( 
g_bFirstSpawn[id] )
    {
        
g_bFirstSpawn[id] = false
        
return
    }

    if( 
is_user_alive(id) && !g_bRestart[id] )
    {
        return
    }

    
g_bRestart[id] = false

    
if( CS_TEAM_T <= cs_get_user_team(id) <= CS_TEAM_CT )
    {
        
g_bDontGiveGun[id] = true
    
}
}

public 
Player_AddPlayerItem(idiWeapon)
{
    if( !
g_bDontGiveGun[id] )
    {
        return 
HAM_IGNORED
    
}

    new 
szClassName[2]
    
pev(iWeaponpev_classnameszClassNamecharsmax(szClassName))
    if( 
szClassName[0] != 'w' )
    {
        return 
HAM_IGNORED
    
}

    if(    !( 
GUNS_BITSUM & (1<<cs_get_weapon_id(iWeapon)) )    )
    {
        return 
HAM_IGNORED
    
}    

    
g_bDontGiveGunid ] = false

    set_pev
(iWeaponpev_flagspev(iWeaponpev_flags) | FL_KILLME)
    
SetHamReturnInteger(0)
    return 
HAM_SUPERCEDE

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:56.


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