Chciałbym zeby plugin OnlyKnifeAtStart.amxx dawał tylko TT noże na starcie a nie CT i TT.Plugin potrzemny mi jest do JB.Z góry dziekuje i pozdrawiam.
/***************************************************
Cvar: amx_knifeonly_time okresla przez jaki czas
nie mozemy podniesc/kupic/uzyc jakiejkolwiek broni
poza nozem i C4. Jezeli przyjmuje wartosc <=0.0
to brana jest pod uwage wartosc cvar'a mp_freezetime
1.0 - wersja poczatkowa
1.1 - zmiana spobu metody uzywanej do broni: hamsandwich -> fakemeta
***************************************************/
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>
new bool: gCan_pickup[33]
new bool: gIn_game[33]
new pcTime, pcFreez
new Float: gAlowtime
public plugin_init()
{
register_plugin("Only Knife At Start", "1.1", "Pavulon")
pcFreez = get_cvar_pointer("mp_freezetime")
pcTime = register_cvar("amx_knifeonly_time", "0.0")
RegisterHam(Ham_Spawn,"player","pre_player_spawn",0)
register_event("WeapPickup","event_weappickup","be")
register_event("CurWeapon","event_curweapon","be", "1=1")
register_event("DeathMsg","event_deathmsg","a")
}
public plugin_cfg()
{
gAlowtime = get_pcvar_float(pcTime)
if (gAlowtime<=0.0)
gAlowtime = get_pcvar_float(pcFreez)
}
public client_putinserver(id)
{
gCan_pickup[id] = false
gIn_game[id] = false
}
public client_disconnect(id)
{
gIn_game[id] = false
gCan_pickup[id] = false
}
public pre_player_spawn(id)
{
gCan_pickup[id] = false
if (task_exists(id))
remove_task(id)
set_task(gAlowtime, "allow_pickup", id)
if (gIn_game[id])
strip_prev(id)
gIn_game[id] = true
return HAM_IGNORED
}
public event_deathmsg()
{
gCan_pickup[read_data(2)] = false
}
public allow_pickup(id)
{
gCan_pickup[id] = true
}
public event_curweapon(id)
{
if (gCan_pickup[id]) return PLUGIN_HANDLED
new wId = read_data(2)
if (wId==6 || wId==29) return PLUGIN_HANDLED
new task_array[2]
task_array[0] = id
task_array[1] = wId
set_task(0.05,"strip_weapon",_ , task_array, 2)
return PLUGIN_HANDLED
}
public event_weappickup(id)
{
if (gCan_pickup[id]) return PLUGIN_HANDLED
new wId = read_data(1)
if (wId==6 || wId==29) return PLUGIN_HANDLED
new task_array[2]
task_array[0] = id
task_array[1] = wId
set_task(0.05,"strip_weapon",_ , task_array, 2)
return PLUGIN_HANDLED
}
public strip_weapon(task_array[2])
{
new id = task_array[0]
if(!is_user_connected(id)) return
fm_strip_user_gun(id, task_array[1])
//ham_strip_weapon(id, task_array[1])
}
stock strip_prev(id)
{
new Weapons[32]
new numWeapons, i, wId
get_user_weapons(id, Weapons, numWeapons)
for (i=0; i<numWeapons; i++)
{
wId = Weapons[i]
if (wId==CSW_KNIFE || wId==CSW_C4)
continue
fm_strip_user_gun(id, wId)
//ham_strip_weapon(id, wId)
}
engclient_cmd(id, "weapon_knife")
}
stock bool:fm_strip_user_gun(index, weapon)
{
new ent_class[32];
new clip, ammo;
if (!weapon && !(weapon = get_user_weapon(index, clip, ammo)))
return false;
get_weaponname(weapon, ent_class, sizeof ent_class - 1);
new ent_weap
while ((ent_weap = engfunc(EngFunc_FindEntityByString, ent_weap, "classname", ent_class)) && pev(ent_weap, pev_owner) != index) {}
if (!ent_weap)
return false;
if (weapon == CSW_SMOKEGRENADE || weapon == CSW_FLASHBANG || weapon == CSW_HEGRENADE) {
set_pev(index, pev_weapons,pev(index, pev_weapons) & ~(1<<weapon))
cs_set_user_bpammo(index,weapon,0)
} else {
engclient_cmd(index, "drop", ent_class);
new ent_box = pev(ent_weap, pev_owner);
if (!ent_box || ent_box == index)
return false;
dllfunc(DLLFunc_Think, ent_box);
}
return true;
}
/*stock ham_strip_weapon(id, wId)
{
new weapon[20]
get_weaponname (wId, weapon, 19)
if(!equal(weapon,"weapon_",7)) return 0
new wEnt
while((wEnt = engfunc(EngFunc_FindEntityByString,wEnt,"classname",weapon)) && pev(wEnt,pev_owner) != id) {}
if(!wEnt) return 0
if(get_user_weapon(id) == wId) ExecuteHamB(Ham_Weapon_RetireWeapon,wEnt)
if(!ExecuteHamB(Ham_RemovePlayerItem,id,wEnt)) return 0
ExecuteHamB(Ham_Item_Kill,wEnt)
set_pev(id,pev_weapons,pev(id,pev_weapons) & ~(1<<wId))
if (wId == CSW_SMOKEGRENADE || wId == CSW_FLASHBANG || wId == CSW_HEGRENADE)
cs_set_user_bpammo(id,wId,0)
client_print(0, print_chat, "HamStrip")
return 1
}*/
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/


Dodatki SourceMod



Temat jest zamknięty



OnlyKnifeAtStart.amxx







