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(PLUGIN, VERSION, AUTHOR)
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=1; id<=g_iMaxPlayers; id++)
{
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(id, iWeapon)
{
if( !g_bDontGiveGun[id] )
{
return HAM_IGNORED
}
new szClassName[2]
pev(iWeapon, pev_classname, szClassName, charsmax(szClassName))
if( szClassName[0] != 'w' )
{
return HAM_IGNORED
}
if( !( GUNS_BITSUM & (1<<cs_get_weapon_id(iWeapon)) ) )
{
return HAM_IGNORED
}
g_bDontGiveGun[ id ] = false
set_pev(iWeapon, pev_flags, pev(iWeapon, pev_flags) | FL_KILLME)
SetHamReturnInteger(0)
return HAM_SUPERCEDE
}
__________________