Como le puedo poner limite a la bazooka
#1
Hola como dice el titulo le quiero colocar limite al plugin bazooka que solo 3 usuarios puedan sacar la bazooka, en que parte del codigo tengo que modificar esa parte

aca el codigo


Código PHP:
/*


Special thanks to:

 -=STN=- MaGe / KaOs / RadidEskimo / Freecode / EJL / JTP10181 / PaintLancer / Kaddar
 Vexd / twistedeuphoria / XxAvalanchexX / pimp daddy / Ronkkrop / Major_victory / Can't Shoot
 
 More for making the original bazooka plugin

 mike_cao for his awesome gore plugin
 
 and anyone else that over looked.
*/

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
#include <fakemeta>
#include <fakemeta_util>
#include <hamsandwich>
#pragma reqlib "dcapi"
native damagecar(iddamage)

#define BA_NORMAL (1<<0) // "a"
#define BA_HEAT (1<<1) // "b"
#define BA_USER (1<<2) // "c"
#define BA_NONE (1<<3) // "d"

#define SEQ_IDLE 0
#define SEQ_FIDGET 1
#define SEQ_RELOAD 2
#define SEQ_FIRE 3
#define SEQ_HOLSTER1 4
#define SEQ_DRAW1 5
#define SEQ_HOLSTER2 6
#define SEQ_DRAW2 7
#define SEQ_IDLE2 8
#define SEQ_FIDGET2 9

#define bit(%1) (1 << CSW_%1)
new mod_name[33]
new 
g_buyzone[33]

const 
PRIMARY_WEAPONS = (1<<CSW_SCOUT)|(1<<CSW_XM1014)|(1<<CSW_MAC10)|(1<<CSW_AUG)|(1<<CSW_UMP45)|(1<<CSW_SG550)|(1<<CSW_GALIL)|(1<<CSW_FAMAS)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M249)|(1<<CSW_M3)|(1<<CSW_M4A1)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_AK47)|(1<<CSW_P90);
new 
Bazooka_Ammo[33]

new 
bool:RoundEnd
new bool:is_cstrike

new wep[33], anim[33]
new 
bool:Has_Bazooka[33]
new 
bool:Allow_Shooting[33]

new 
bool:g_restart_attempt[33]

new 
RocketSmoke
new mdl_gib_head
new mdl_gib_lung
new mdl_gib_meat
new mdl_gib_flesh
new mdl_gib_spine
new spr_blood_drop
new spr_blood_spray
new mdl_gib_legbone
new g_sModelIndexSmoke
new g_sModelIndexFireball
new cost
new bool:E_KeyPress_Delay[33]

new 
gravity;

static 
PLUGIN_NAME[] = "Bazooka_Slot1"
static PLUGIN_AUTHOR[] = "man_s_our"
static PLUGIN_VERSION[] = "2"

public plugin_init () {

 
register_plugin(PLUGIN_NAMEPLUGIN_VERSIONPLUGIN_AUTHOR)
 
register_concmd("bazooka","cmd_Drop_Bazooka",ADMIN_BAN)
 
register_concmd("rpg","cmd_BuyBazooka",ADMIN_USER)
 
register_clcmd("say /buybazooka","cmd_BuyBazooka",ADMIN_USER,"- Buys a bazooka")
 
register_clcmd("say_team /buybazooka","cmd_BuyBazooka",ADMIN_USER,"- Buys a bazooka")
 
register_clcmd("bazooka_give","cmd_GiveBazooka",ADMIN_BAN,"<@all/ct/t>/userid - Gives free bazooka")
 
register_clcmd("fullupdate","cmd_FullUpDate"
 
register_clcmd("drop""Event_WeaponDrop")
 
//buynames
 
register_clcmd("m249""Event_WeaponDrop")
 
register_clcmd("228compact""Event_WeaponDrop")
 
register_clcmd("shield""Event_WeaponDrop")
 
register_clcmd("scout""Event_WeaponDrop")
 
register_clcmd("xm1014""Event_WeaponDrop")
 
register_clcmd("autoshotgun""Event_WeaponDrop")
 
register_clcmd("mac10""Event_WeaponDrop")
 
register_clcmd("aug""Event_WeaponDrop")
 
register_clcmd("bullpup""Event_WeaponDrop")
 
register_clcmd("ump45""Event_WeaponDrop")
 
register_clcmd("sg550""Event_WeaponDrop")
 
register_clcmd("krieg550""Event_WeaponDrop")
 
register_clcmd("galil""Event_WeaponDrop")
 
register_clcmd("defender""Event_WeaponDrop")
 
register_clcmd("famas""Event_WeaponDrop")
 
register_clcmd("clarion""Event_WeaponDrop")
 
register_clcmd("awp""Event_WeaponDrop")
 
register_clcmd("magnum""Event_WeaponDrop")
 
register_clcmd("mp5""Event_WeaponDrop")
 
register_clcmd("smg""Event_WeaponDrop")
 
register_clcmd("m3""Event_WeaponDrop")
 
register_clcmd("12gauge""Event_WeaponDrop")
 
register_clcmd("m4a1""Event_WeaponDrop")
 
register_clcmd("tmp""Event_WeaponDrop")
 
register_clcmd("mp""Event_WeaponDrop")
 
register_clcmd("g3sg1""Event_WeaponDrop")
 
register_clcmd("d3au1""Event_WeaponDrop")
 
register_clcmd("sg552""Event_WeaponDrop")
 
register_clcmd("krieg552""Event_WeaponDrop")
 
register_clcmd("ak47""Event_WeaponDrop")
 
register_clcmd("cv47""Event_WeaponDrop")
 
register_clcmd("p90""Event_WeaponDrop")
 
register_clcmd("c90""Event_WeaponDrop")
 
 
register_event("CurWeapon","Event_CurWeapon","be","1=1")
 
register_event("DeathMsg","Event_DeathMsg","a")
 
register_event("HLTV","Event_NewRound""a","1=0","2=0")
 
register_event("ResetHUD","Event_HudReset","be")
 
register_event("TextMsg","Event_WeaponDrop","be","2=#Weapon_Cannot_Be_Dropped")
 
register_event("TextMsg","Event_RestartAttempt","a","2=#Game_will_restart_in")
 
register_event("StatusIcon","Event_BuyZone","b","2=buyzone")
 
register_forward(FM_PlayerPreThink"PlayerPreThink")
 
register_logevent("LogEvent_RoundStart",2,"1=Round_Start")
 
register_logevent("LogEvent_RoundEnd",2,"1=Round_End")
 
 
register_forward(FM_CmdStart,"fw_CmdStart")
 
register_forward(FM_EmitSound,"fw_EmitSound")

 
get_modname(mod_name,31)
 
is_cstrike equal(mod_name,"cstrike") ? true false
 gravity 
register_cvar("grav""1",FCVAR_SERVER)
 
cost register_cvar("bazooka_cost""5000",FCVAR_SERVER)
 
RegisterHam(Ham_Item_AddToPlayer"weapon_m249" "Fw_Item_AddToPlayer_Post"1);
 
register_clcmd("weapon_rpg""Select_Weapon");
}
// Here we replace the HUD sprites for our custom weapon.
public Fw_Item_AddToPlayer_Post(weaponid)
{
 if(!
pev_valid(weapon))
 return 
HAM_IGNORED
 
if(Has_Bazooka[id]) //If player has the bazooka, we show these sprites.
 
{
 
message_begin(MSG_ONEget_user_msgid("WeaponList"), .player id);
 
write_string("weapon_rpg"); // WeaponName  
 
write_byte(3); // PrimaryAmmoID  
 
write_byte(200); // PrimaryAmmoMaxAmount  
 
write_byte(-1); // SecondaryAmmoID  
 
write_byte(-1); // SecondaryAmmoMaxAmount  
 
write_byte(0); // SlotID (0...N)  
 
write_byte(4); // NumberInSlot (1...N)  
 
write_byte(CSW_M249);  // WeaponID
 
write_byte(0); // Flags  
 
message_end();
 } else { 
//Else if not, we show the default sprites of our base weapon.
 
message_begin(MSG_ONEget_user_msgid("WeaponList"), .player id);
 
write_string("weapon_m249"); // WeaponName  
 
write_byte(3); // PrimaryAmmoID
 
write_byte(200); // PrimaryAmmoMaxAmount  
 
write_byte(-1); // SecondaryAmmoID  
 
write_byte(-1); // SecondaryAmmoMaxAmount  
 
write_byte(0); // SlotID (0...N)  
 
write_byte(4); // NumberInSlot (1...N)  
 
write_byte(CSW_M249); // WeaponID  
 
write_byte(0); // Flags  
 
message_end();
 }
 
 return 
HAM_HANDLED 
}
public 
Select_Weapon(id)
{
 
client_cmd(id"weapon_m249");
 return 
PLUGIN_HANDLED

public 
plugin_precache ()  {
 
 
precache_model("models/w_rpg.mdl")
 
precache_model("models/v_rpg.mdl")
 
precache_model("models/p_rpg.mdl")
 
precache_model("models/rpgrocket.mdl")
 
precache_generic("sprites/weapon_rpg.txt");
 
precache_generic("sprites/640hud71.spr");
 
precache_generic("sprites/640hud51.spr");
 
precache_generic("sprites/640hud30.spr");
 
precache_generic("sprites/320hud2.spr");
 
precache_generic("sprites/320hud1.spr");
 
 
precache_model("models/v_m249.mdl")
 
precache_model("models/p_m249.mdl")
 
 
precache_sound("items/gunpickup4.wav")
 
 
precache_sound("weapons/nuke_fly.wav")
 
precache_sound("weapons/dryfire1.wav")
 
precache_sound("weapons/mortarhit.wav")
 
precache_sound("weapons/rocketfire1.wav")
 
 
precache_sound("ambience/particle_suck2.wav")
 
 
spr_blood_drop precache_model("sprites/blood.spr")
 
spr_blood_spray precache_model("sprites/bloodspray.spr")
 
 
mdl_gib_lung precache_model("models/GIB_Lung.mdl")
 
mdl_gib_meat precache_model("models/GIB_B_Gib.mdl")
 
mdl_gib_head precache_model("models/GIB_Skull.mdl")
 
mdl_gib_flesh precache_model("models/Fleshgibs.mdl")
 
mdl_gib_spine precache_model("models/GIB_B_Bone.mdl")
 
mdl_gib_legbone precache_model("models/GIB_Legbone.mdl")
 
 
g_sModelIndexSmoke  precache_model("sprites/steam1.spr")
 
g_sModelIndexFireball precache_model("sprites/zerogxplode.spr")
 
 
RocketSmoke precache_model("sprites/smoke.spr")
 
}

/*drop_primary(id)
{
 if(cs_get_user_hasprim(id))
 {
 client_cmd(id, "weapon_p228");
 client_cmd(id, "weapon_scout");
 client_cmd(id, "weapon_xm1014");
 client_cmd(id, "weapon_mac10");
 client_cmd(id, "weapon_aug");
 client_cmd(id, "weapon_ump45");
 client_cmd(id, "weapon_sg550");
 client_cmd(id, "weapon_galil");
 client_cmd(id, "weapon_famas");
 client_cmd(id, "weapon_awp");
 client_cmd(id, "weapon_mp5navy");
 client_cmd(id, "weapon_m249");
 client_cmd(id, "weapon_m3");
 client_cmd(id, "weapon_m4a1");
 client_cmd(id, "weapon_tmp");
 client_cmd(id, "weapon_g3sg1");
 client_cmd(id, "weapon_sg552");
 client_cmd(id, "weapon_ak47");
 client_cmd(id, "weapon_p90");
 }
 new parm[1]
 parm[0] = id
 set_task(0.1, "BuyBazooka", id * 555, parm, 1)
}*/
drop_primary(id)
{
 static 
weapons[32], numiwpn_id;
 
num 0// reset passed weapons count (bugfix)
 
 
 // Getting all of our player's weapons
 
get_user_weapons(idweaponsnum);
 
 
 
// We then loop through all of them and drop everything listed
 // on our PRIMARY_WEAPONS_BIT_SUM, which are all primaries.
 
for (0numi++)
 {
 
// Prevent re-indexing the array
 
wpn_id weapons[i];
 
 if(
1<<wpn_id PRIMARY_WEAPONS//Does the weapon id match something in our PRIMARY_WEAPONS_BIT_SUM?
 
{
 
// Getting the weapon entity name (wname) using the weapon index (wpn_id).
 
static wname[32]; get_weaponname(wpn_idwnamecharsmax(wname));

 
 
// Player drops the weapon like a hot potato.
 
engclient_cmd(id"drop"wname);
 }
 }
}
stock ham_strip_weapon(id,weapon[])
{
 if(!
equal(weapon,"weapon_",7)) return 0;
 
 new 
wId get_weaponid(weapon);
 if(!
wId) return 0;
 
 new 
wEnt;
 while((
wEnt engfunc(EngFunc_FindEntityByStringwEnt"classname"weapon)) && pev(wEntpev_owner) != id) {}
 if(!
wEnt) return 0;
 
 new 
iTmp;
 if(
get_user_weapon(idiTmpiTmp) == wIdExecuteHamB(Ham_Weapon_RetireWeaponwEnt);
 
 if(!
ExecuteHamB(Ham_RemovePlayerItemidany:wEnt)) return 0;
 
 
ExecuteHamB(Ham_Item_KillwEnt);
 
set_pev(idpev_weaponspev(idpev_weapons) & ~(1<<wId));
 
 return 
1;
}
public 
Event_BuyZone(id) {
 
 
g_buyzone[id] = read_data(1)
 
}

public 
client_connect (id) {
 
 
Has_Bazooka[id] = false
 Allow_Shooting
[id] = false
 E_KeyPress_Delay
[id] = false
 
}

public  client_disconnect (id) {
 
 
Has_Bazooka[id] = false
 Allow_Shooting
[id] = false
 E_KeyPress_Delay
[id] = false
 
}

// Freeze Time.
public Event_NewRound () {
 
 new 
iCurrent find_ent_by_class(-1"rpgrocket")
 while ((
iCurrent find_ent_by_class(-1"rpgrocket")) != 0) {
 
 new 
id entity_get_edict(iCurrentEV_ENT_owner)
 
remove_missile(id,iCurrent)
 
 }
 
}
// Player Spawn
public Event_PlayerSpawn  (id) {
 
 
// Reset Bazooka's Ammo
 
Bazooka_Ammo[id] = 5

 
// Gibs - Unhide Players
 
set_user_rendering(id,kRenderFxNone,0,0,0,kRenderTransAlpha,255)
 
 
// Removed any rockets in world.
 
new Rocket find_ent_by_class(-1"rpgrocket")
 while (
Rocket 0) {

 
remove_entity(Rocket)
 
Rocket find_ent_by_class(Rocket"rpgrocket")
 
 }
 
 
// Removed any rpglancher in world.
 
new RPG find_ent_by_class(-1"rpglancher")
 while (
RPG 0) {
 
 
remove_entity(RPG)
 
 
RPG find_ent_by_class(RPG"rpglancher")
 
 }
 
 new 
v_oldmodel[64], p_oldmodel[64]
 
 
entity_get_string(idEV_SZ_viewmodelv_oldmodel63)
 
entity_get_string(idEV_SZ_weaponmodelp_oldmodel63)
 
 if (
equal(v_oldmodel"models/v_rpg.mdl") || equal(p_oldmodel"models/p_rpg.mdl")) {
 
 if (!
Has_Bazooka[id]) {
 new 
weaponidclipammo
 weaponid 
get_user_weapon(idclipammo)
 
 new 
weaponname[64]
 
get_weaponname(weaponidweaponname63)
 
 new 
v_model[64], p_model[64]
 
format(v_model63"%s"weaponname)
 
format(p_model63"%s"weaponname)
 
 
replace(v_model63"weapon_""v_")
 
format(v_model63"models/%s.mdl"v_model)
 
entity_set_string(idEV_SZ_viewmodelv_model)
 
 
replace(p_model63"weapon_""p_")
 
format(p_model63"models/%s.mdl"p_model)
 
entity_set_string(idEV_SZ_weaponmodelp_model)
 
 }
 }

 return 
PLUGIN_CONTINUE
 
}

// New Round - Freeze Time End.
public LogEvent_RoundStart () {
 
 
RoundEnd false

 
new players[32], num
 get_players
(playersnum"a")
    
 
for (new inum; ++i)
 if (
Has_Bazooka[players[i]])
 
Allow_Shooting[players[i]] = true
 
 
return PLUGIN_CONTINUE

}

// Round End 
public LogEvent_RoundEnd () {
 
 
RoundEnd true
 
 
new players[32], num
 get_players
(playersnum"a")
    
 
for (new inum; ++i)
 if (
Has_Bazooka[players[i]])
 
Allow_Shooting[players[i]] = false
 
 
return PLUGIN_CONTINUE

}

public 
cmd_FullUpDate ()
{
 return 
PLUGIN_HANDLED
}

public 
Event_RestartAttempt () {
 
 new 
players[32], num
 get_players
(playersnum"a")
    
 
for (new inum; ++i)
 
g_restart_attempt[players[i]] = true
 
}

public 
Event_HudReset (id) {
 
 if (
g_restart_attempt[id]) {
    
 g_restart_attempt
[id] = false
 
 
return
 
 }

 
Event_PlayerSpawn (id)
    
}

public 
rpg_idle (data[]) {
 
 if (
Bazooka_Ammo[data[0]] > 0)
 
anim[data[0]] = SEQ_IDLE//entity_set_int(data[0], EV_INT_weaponanim, SEQ_IDLE)
 
 
if (Bazooka_Ammo[data[0]] <= 0)
 
anim[data[0]] = SEQ_IDLE2//entity_set_int(data[0], EV_INT_weaponanim, SEQ_IDLE2)
 
}

public 
rpg_reload_start (data[]) {
 if ((
Bazooka_Ammo[data[0]] > 0))
 
anim[data[0]] = SEQ_RELOAD //entity_set_int(data[0], EV_INT_weaponanim, SEQ_RELOAD)
 
else
 
anim[data[0]] = SEQ_IDLE2 //entity_set_int(data[0], EV_INT_weaponanim, SEQ_IDLE2)
}

public 
rpg_fidget (data[]) {
 if (!
RoundEnd)
 
Allow_Shooting[data[0]] = true;

 if (
Bazooka_Ammo[data[0]] > 0)
 
anim[data[0]] = SEQ_FIDGET //entity_set_int(data[0], EV_INT_weaponanim, SEQ_FIDGET)
 
 
if (Bazooka_Ammo[data[0]] <= 0)
 
anim[data[0]] = SEQ_FIDGET2 //entity_set_int(data[0], EV_INT_weaponanim, SEQ_FIDGET2)
 
 
set_task(6.0"rpg_idle"data[0]+2023data[0], 1)
 
 
}

public 
fw_EmitSound (idchannelsample[]) {
 
 if(!
is_user_alive(id) || !is_user_connected(id)) 
 return 
FMRES_IGNORED
 
 
if(Has_Bazooka[id]) {
 
 if(
containi(sample"weapons/m249") != -1)
 return 
FMRES_SUPERCEDE
 
 
}
 
 return 
FMRES_IGNORED
 
}

public 
fire_rocket (id) {
 
 new 
data[1]
 
 
data[0] = id
 
 
//Start reload animation.
 
set_task(1.0"rpg_reload_start"id+2021data1)
 
//Ends reload animation and enables fireing.
 
set_task(3.1"rpg_fidget"id+2022data1)
 
 new 
Float:StartOrigin[3], Float:Angle[3]
 
 new 
PlayerOrigin[3]
 
get_user_origin(idPlayerOrigin1)
 
 
StartOrigin[0] = float(PlayerOrigin[0])
 
StartOrigin[1] = float(PlayerOrigin[1])
 
StartOrigin[2] = float(PlayerOrigin[2])
 
 
entity_get_vector(idEV_VEC_v_angleAngle)
 
 
Angle[0] = Angle[0] * -1.0
 
 
new RocketEnt create_entity("info_target")
 
 
entity_set_string(RocketEntEV_SZ_classname"rpgrocket")
 
entity_set_model(RocketEnt"models/rpgrocket.mdl")
 
entity_set_origin(RocketEntStartOrigin)
 
entity_set_vector(RocketEntEV_VEC_anglesAngle)
 
 new 
Float:MinBox[3] = {-1.0, -1.0, -1.0}
 new 
Float:MaxBox[3] = {1.01.01.0}
 
 
entity_set_vector(RocketEntEV_VEC_minsMinBox)
 
entity_set_vector(RocketEntEV_VEC_maxsMaxBox)
 
 
entity_set_int(RocketEntEV_INT_solid2)
 if(
get_pcvar_num(gravity))
 {
 
entity_set_int(RocketEntEV_INT_movetypeMOVETYPE_TOSS)
 
set_pev(RocketEntpev_gravity0.1)
 }
 else
 
entity_set_int(RocketEntEV_INT_movetypeMOVETYPE_FLY)
 
entity_set_edict(RocketEntEV_ENT_ownerid)
 
 new 
Float:Velocity[3]
 
 
VelocityByAim(id2000Velocity)
 
entity_set_vector(RocketEntEV_VEC_velocityVelocity
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_BEAMFOLLOW)
 
write_short(RocketEnt)
 
write_short(RocketSmoke)
 
write_byte(3)
 
write_byte(5)
 
write_byte(50)
 
write_byte(50)
 
write_byte(50)
 
write_byte(254)
 
message_end()
 
 
emit_sound(RocketEntCHAN_WEAPON"weapons/rocketfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
emit_sound(RocketEntCHAN_VOICE"weapons/nuke_fly.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
Bazooka_Ammo[id]--;
 
 return 
PLUGIN_HANDLED
}

public 
remove_missile (id,missile) {
 
 new 
Float:fl_origin[3]
 
 
entity_get_vector(missileEV_VEC_originfl_origin)
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_IMPLOSION)
 
write_coord(floatround(fl_origin[0]))
 
write_coord(floatround(fl_origin[1]))
 
write_coord(floatround(fl_origin[2]))
 
write_byte (200)
 
write_byte (40)
 
write_byte (45)
 
message_end()
 
 
emit_sound(missileCHAN_WEAPON"ambience/particle_suck2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
emit_sound(missileCHAN_VOICE"ambience/particle_suck2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 
 
attach_view(id,id)
 
remove_entity(missile)
 
 return 
PLUGIN_CONTINUE
 
}

public 
pfn_touch (touchertouched)
{
 new 
ClassName1[32]
 new 
ClassName2[32]

 if(!
is_valid_ent(toucher))
 return 
PLUGIN_CONTINUE

 
if (is_valid_ent(toucher))
 
entity_get_string(toucherEV_SZ_classnameClassName131)
 
 if (
is_valid_ent(touched))
 
entity_get_string(touchedEV_SZ_classnameClassName231)
 
 if (
equal(ClassName1"rpgrocket")) {
 new 
vExplodeAt[3]
 new 
Float:fl_vExplodeAt[3]
 
entity_get_vector(toucherEV_VEC_originfl_vExplodeAt)

 
vExplodeAt[0] = floatround(fl_vExplodeAt[0])
 
vExplodeAt[1] = floatround(fl_vExplodeAt[1])
 
vExplodeAt[2] = floatround(fl_vExplodeAt[2])

 
emit_sound(toucherCHAN_WEAPON"weapons/mortarhit.wav"1.00.50PITCH_NORM)
 
emit_sound(toucherCHAN_VOICE"weapons/mortarhit.wav"1.00.50PITCH_NORM)

 for (new 
Explosion 1Explosion 8Explosion++) {
 
 
// Random Explosion 8 Times
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_SPRITE)
 
write_coord(vExplodeAt[0] + random_num(-60,60))
 
write_coord(vExplodeAt[1] + random_num(-60,60))
 
write_coord(vExplodeAt[2] +128)
 
write_short(g_sModelIndexFireball)
 
write_byte(random_num(30,65))
 
write_byte(255)
 
message_end()
 
 }

 for (new 
Smoke 1Smoke 3Smoke++) {
 
 
// Random Smoke 3 Times
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_SMOKE)
 
write_coord(vExplodeAt[0])
 
write_coord(vExplodeAt[1])
 
write_coord(vExplodeAt[2] + 256)
 
write_short(g_sModelIndexSmoke)
 
write_byte(random_num(80,150))
 
write_byte(random_num(5,10))
 
message_end()
 }
 
 
// Create the burn decal
 
message_begin(MSG_BROADCASTSVC_TEMPENTITY)
 
write_byte(TE_GUNSHOTDECAL)
 
write_coord(vExplodeAt[0])
 
write_coord(vExplodeAt[1])
 
write_coord(vExplodeAt[2])
 
write_short(0
 
 if (
is_cstrikewrite_byte(random_num(46,48))  // decal
 
if (!is_cstrikewrite_byte(random_num(58,60)) // decal

 
message_end()

 new 
Max_Damage 300
 
new Damage_Radius 300
 
 
new PlayerPos[3], DistanceDamage
 
 
for (new 132i++) {
 
 if (
is_user_alive(i) == 1) {
 
 
get_user_origin(iPlayerPos)

 
Distance get_distance(PlayerPosvExplodeAt)
 
 if (
Distance <= Damage_Radius) {  // Screenshake Radius
 
 
message_begin(MSG_ONEget_user_msgid("ScreenShake"), {0,0,0}, i)  // Shake Screen
 
write_short(1<<14)
 
write_short(1<<14)
 
write_short(1<<14)
 
message_end()
 
 new 
attacker entity_get_edict(toucherEV_ENT_owner)

 
Damage Max_Damage floatround(floatmul(float(Max_Damage), floatdiv(float(Distance), float(Damage_Radius))))
 
 if (!
get_user_godmode(i)) {

 if(
cvar_exists("mp_friendlyfire")) {

 if( 
get_cvar_num("mp_friendlyfire")) {


 
do_victim(i,attacker,Damage)

 }

 else {

 if(
get_user_team(i) != get_user_team(attacker))
 
do_victim(i,attacker,Damage)
 
 }
 
 }

 else {
 
 
do_victim(i,attacker,Damage)
 
 }
 

 }

 else {
 
 
do_victim(i,attacker,Damage)
 
 }
 
 }
 
 }
 
 }
 
 
remove_entity(toucher)
 if(
is_valid_ent(touched))
 if(
equal(ClassName2"func_vehicle") || equal(ClassName2"func_tracktrain"))
 
damagecar(touched100);
 
 
//*****************************************//
 // destroy ents within 1/4 of Damage radius//
 //*****************************************//
 
static Entity_List[21]
 
 new 
entites_in_radius
 entites_in_radius 
find_sphere_class(0"func_breakable",Damage_Radius 0.20,Entity_List,20,fl_vExplodeAt)
 
 for(new 
i0;entites_in_radiusi++) {
 
 
force_use(Entity_List[i],Entity_List[i])
 
remove_task(Entity_List[i])
 }
 
 }
 
 if (
equal(ClassName1"rpglancher")) {

 
 
 new 
Picker[32]

 if (
is_valid_ent(touched))
 
entity_get_string(touchedEV_SZ_classnamePicker31)

 if (
equal(Picker"player")) {
 
 
drop_primary(touched)
 
Bazooka_Ammo[touched] = entity_get_int(toucherEV_INT_iuser1)
 
wep[touched] = give_item(touched"weapon_m249");
 
 
Allow_Shooting[touched] = true
 Has_Bazooka
[touched] = true
 entity_set_int
(touchedEV_INT_weaponanimSEQ_IDLE)
 
 
 
client_print(touchedprint_chat"[Bazooka] You have picked up a bazooka!")
 
emit_sound(touchedCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 
remove_entity(toucher)

 new 
temp[2], weaponID get_user_weapon(touchedtemp[0], temp[1])
 if(
weaponID == CSW_M249) {

 
Event_CurWeapon(touched

 if (
Bazooka_Ammo[touched] > 0entity_set_int(touchedEV_INT_weaponanimSEQ_RELOAD)
 if (
Bazooka_Ammo[touched] <= 0entity_set_int(touchedEV_INT_weaponanimSEQ_IDLE2)

 }
 
 }
 
 
 }
 
 return 
PLUGIN_CONTINUE

}

public 
do_victim (victim,attacker,Damage) {

 if(
Damage >= get_user_health(victim))
 {
 
util_kill(attackervictim)
 if (
Damage 100)
 {
 new 
iOrigin[3]
 
get_user_origin(victim,iOrigin)
 
set_user_rendering(victim,kRenderFxNone,0,0,0,kRenderTransAlpha,0)
 
fx_gib_explode(iOrigin,3)
 
fx_blood_large(iOrigin,5)
 
fx_blood_small(iOrigin,15)
 
iOrigin[2] = iOrigin[2] - 20
 set_user_origin
(victim,iOrigin)
 }
 
 }

 else
 
set_user_health(victim,get_user_health(victim) - Damage )
}

util_kill(killervictim)
{
 if (
get_user_team(killer) != get_user_team(victim))
 {
 
user_silentkill(victim);
 
make_deathmsg(killervictim0"rpg");

 
set_user_frags(killerget_user_frags(killer) + 1);

 new 
money cs_get_user_money(killer) + 300;
 if (
money >= 16000)
 
cs_set_user_money(killer16000);
 else
 
cs_set_user_money(killermoney1);
 }
 else
 {
 
user_silentkill(victim);
 
make_deathmsg(killervictim0"rpg");
 
set_user_frags(killerget_user_frags(killer) - 1);
 new 
money cs_get_user_money(killer) - 3300;
 if (
money <= 0)
 
cs_set_user_money(killer0);
 else
 
cs_set_user_money(killermoney1);
 }

 
message_begin(MSG_BROADCASTget_user_msgid("ScoreInfo"));
 
write_byte(killer); // Destination
 
write_short(get_user_frags(killer)); // Frags
 
write_short(cs_get_user_deaths(killer)); // Deaths
 
write_short(0); // Player class
 
write_short(get_user_team(killer)); // Team
 
message_end();
 
message_begin(MSG_BROADCASTget_user_msgid("ScoreInfo"));
 
write_byte(victim); // Destination
 
write_short(get_user_frags(victim)); // Frags
 
write_short(cs_get_user_deaths(victim)); // Deaths
 
write_short(0); // Player class
 
write_short(get_user_team(victim)); // Team
 
message_end();
}
public 
cmd_Drop_Bazooka (idlevelcid) {
 
 if (!
cmd_access(idlevelcid1))
 return 
PLUGIN_HANDLED
 
 drop_lancher
(id,0)
 
 return 
PLUGIN_HANDLED
 
}

public 
drop_rpglancher (id) {

 
drop_lancher(id,1)
 
 
Bazooka_Ammo[id] = 0
 Has_Bazooka
[id] = false
 
 Event_CurWeapon
(id)
 
 return 
PLUGIN_HANDLED
 
}

public 
drop_lancher (idsel) {

 new 
Float:PlayerOrigin[3], Float:End[3], Float:Return[3], Float:TraceDirection[3], Float:Angles[3]

 if (
sel == 0VelocityByAim(id64TraceDirection)
 if (
sel == 1VelocityByAim(id200TraceDirection)
 
 
entity_get_vector(idEV_VEC_originPlayerOrigin)

 if (
sel == 1entity_get_vector(idEV_VEC_anglesAngles)

 
End[0] = TraceDirection[0] + PlayerOrigin[0]
 
End[1] = TraceDirection[1] + PlayerOrigin[1]
 
End[2] = TraceDirection[2] + PlayerOrigin[2]
 
 
trace_line(idPlayerOriginEnd, Return)

 Return[
2] = PlayerOrigin[2]
 
 new 
RPG create_entity("info_target")
 
 
entity_set_string(RPGEV_SZ_classname"rpglancher")
 
entity_set_model(RPG"models/w_rpg.mdl")
 
entity_set_origin(RPG, Return)
 
 if (
sel == 1) {
 
 
Angles[0] = 0.0
 Angles
[2] = 0.0
 
 
}
 
 if ( 
sel == 0entity_set_vector(RPGEV_VEC_anglesAngles)
 
 new 
Float:MinBox[3] = {-16.0, -16.00.0}
 new 
Float:MaxBox[3] = {16.016.016.0}

 
entity_set_vector(RPGEV_VEC_minsMinBox)
 
entity_set_vector(RPGEV_VEC_maxsMaxBox)
 
 
entity_set_int(RPGEV_INT_solid1)
 
entity_set_int(RPGEV_INT_movetype6)

 if (
sel == 0entity_set_int(RPGEV_INT_iuser15)
 if (
sel == 0entity_set_int(RPGEV_INT_iuser20)
 if (
sel == 0entity_set_int(RPGEV_INT_iuser30)
 
 if (
sel == 1entity_set_int(RPGEV_INT_iuser1Bazooka_Ammo[id])

 return 
PLUGIN_HANDLED
 
}

public 
delay (data2[]) {
 
 
E_KeyPress_Delay[data2[0]] = false
 
}

public 
PlayerPreThink(id)
{
 if(!
is_user_connected(id)) return FMRES_IGNORED
 
if(!is_user_alive(id)) return FMRES_IGNORED
 
if(!Has_Bazooka[id]) return FMRES_IGNORED
 
 entity_set_int
(idEV_INT_weaponanimanim[id])
 new 
Float:v[3], Float:a[3]
 new 
ent ent find_ent_by_class(-1"rpgrocket")
 while(
ent 0)
 {
 
pev(entpev_velocityv)
 
vector_to_angle(va)
 
set_pev(entpev_anglesa)
 
ent find_ent_by_class(ent"rpgrocket")
 }
 new 
weaponidclipammo
 weaponid 
get_user_weapon(idclipammo)
 
cs_set_weapon_ammo(wep[id], 0);
 
cs_set_user_bpammo(idCSW_M249Bazooka_Ammo[id]);
 if (
weaponid == CSW_M249) {
 
 new 
buttons pev(id,pev_button)
 new 
attack get_user_button(id) & IN_ATTACK
 
new oldattack get_user_oldbutton(id) & IN_ATTACK

 
 
if((buttons IN_ATTACK) && Has_Bazooka[id])
 
buttons &= ~IN_ATTACK


 set_pev
(idpev_buttonbuttons);
 
 if (
attack && !oldattack && Has_Bazooka[id])
 {
 
emit_sound(idCHAN_WEAPON"weapons/dryfire1.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 if (
Allow_Shooting[id] && Bazooka_Ammo[id] > 0)
 {
 
 
remove_task (id+2023
 
 
Allow_Shooting[id] = false
 
 entity_set_int
(idEV_INT_weaponanimSEQ_FIRE)

 
fire_rocket(id)
 
 }
 
 }
 
 }
 
 return 
FMRES_HANDLED
 
}

public 
cmd_BuyBazooka (id) {
 
 if(!
is_user_alive(id)) 
 
client_print(idprint_center"You cant buy when your dead!")
 else if(
cs_get_user_money(id) < get_pcvar_num(cost))
 
client_print(idprint_center"Insuffisant funds, you need %d to buy the bazooka"get_pcvar_num(cost))

 else {
 
drop_primary(id)
 
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(cost), 1)
 
wep[id] = give_item(id"weapon_m249");
 
 
Has_Bazooka[id] = true
 entity_set_int
(idEV_INT_weaponanimSEQ_IDLE)
 
Allow_Shooting[id] = true
 
 Bazooka_Ammo
[id] = 5


 client_print
(idprint_chat"[Bazooka] You have successfully bought a bazooka!")
 
client_print(idprint_chat"[Bazooka] What are you going to do now!?")
 
 new 
temp[2], weaponID get_user_weapon(idtemp[0], temp[1])
 
 if(
weaponID == CSW_M249) {//
 
 
Event_CurWeapon(id
 
entity_set_int(idEV_INT_weaponanimSEQ_FIDGET)
 
 }
 
 else {
 
 
client_cmd(id"weapon_m249")
 
 }
 
 
emit_sound(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 }

 return 
PLUGIN_HANDLED

}

public 
cmd_GiveBazooka (idlevelcid) {
 
 if(!
cmd_access(idlevelcid2))
 return 
PLUGIN_HANDLED
 
 
new Arg1[64], target
 read_argv
(1Arg163)
 
 new 
adminName[32]
 
get_user_name(idadminName31)
 
 new 
targetTeam
 
new Players[32], iNum
 
 
if(Arg1[0] == '@') {
 
 if(
equali(Arg1[1], "all")) {
 
 
targetTeam 0
 get_players
(PlayersiNum"a")
 
 } 
 
 else if(
equali(Arg1[1], "t")) {
 
 
targetTeam 1
 get_players
(PlayersiNum"ae" "terrorist")
 
 } 
 
 else if(
equali(Arg1[1], "ct")) {
 
 
targetTeam 2
 get_players
(PlayersiNum"ae" "ct")
 
 }
 
 for(new 
0iNum; ++i)
 {
 
 
target Players[i]
 
drop_primary(target)
 
wep[target] = give_item(target"weapon_m249"); 
 
 
Has_Bazooka[target] = true
 anim
[target] = SEQ_IDLE
 Allow_Shooting
[target] = true
 
 Bazooka_Ammo
[target] = 5
 
new temp[2], weaponID get_user_weapon(targettemp[0], temp[1])
 
 if(
weaponID == CSW_M249)
 {
 
 
Event_CurWeapon(target
 
entity_set_int(targetEV_INT_weaponanimSEQ_FIDGET)
 }
 else
 {
 
client_cmd(target"weapon_m249")
 }
 
emit_sound(targetCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
client_print(targetprint_chat"You have been given a bazooka")
 }
 
 switch(
targetTeam) {
 
 case 
0client_print(0print_chat"Admin: %s has given everyone a bazooka"adminName)
 case 
1client_print(0print_chat"Admin: %s has given all terrorist a bazooka"adminName)
 case 
2client_print(0print_chat"Admin: %s has given all ct's a bazooka"adminName)
 
 }
 
 }
 
 else {
 
 
target cmd_target(idArg10)
 
 if(!
is_user_connected(target) || !is_user_alive(target))
 return 
PLUGIN_HANDLED
 
 
new targetName[32]
 
get_user_name(targettargetName31)
 
 
wep[target] = give_item(target"weapon_m249");
 
 
Has_Bazooka[target] = true
 Allow_Shooting
[target] = true
 
 Bazooka_Ammo
[target] = 5

 
new temp[2], weaponID get_user_weapon(targettemp[0], temp[1])
 
 if(
weaponID == CSW_M249) {//
 
 
Event_CurWeapon(target
 
anim[target] = SEQ_FIDGET
 
 
}
 
 else {
 
 
client_cmd(target"weapon_m249")
 
 }
 
 
emit_sound(targetCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 
client_print(targetprint_chat"You have been given a bazooka.")
 
client_print(targetprint_chat"Admin: %s has given you a bazooka"adminName)
 
 }
 
 return 
PLUGIN_HANDLED
 
}

public 
Event_CurWeapon (id) {
 
 if(!
is_user_alive(id)) 
 return 
PLUGIN_CONTINUE
 
 
new weaponidclipammo
 
 weaponid 
get_user_weapon(idclipammo)
 
 if ((
weaponid == CSW_M249) && (Has_Bazooka[id])) {
 
 
entity_set_string(idEV_SZ_viewmodel"models/v_rpg.mdl")
 
entity_set_string(idEV_SZ_weaponmodel"models/p_rpg.mdl")
 
entity_set_int(idEV_INT_weaponanimSEQ_FIDGET)
 
Fw_Item_AddToPlayer_Post(CSW_M249id)
 return 
PLUGIN_HANDLED
 
 
}
 
 if ((
weaponid == CSW_M249) && (!Has_Bazooka[id]))
 {
 
entity_set_string(idEV_SZ_viewmodel"models/v_m249.mdl")
 
entity_set_string(idEV_SZ_weaponmodel"models/p_m249.mdl")
 
emit_sound(idCHAN_ITEM"weapons/m249_deploy1.wav"VOL_NORMATTN_NORM0PITCH_NORM
 
entity_set_int(idEV_INT_weaponanimSEQ_FIRE)
 
Fw_Item_AddToPlayer_Post(CSW_M249id)
 return 
PLUGIN_HANDLED
 
 
}
 
 return 
PLUGIN_CONTINUE
 
}


public 
Event_DeathMsg () {
 
 new 
id read_data(2)
 
 if(!
is_user_connected(id) || !Has_Bazooka[id])
 return 
PLUGIN_CONTINUE

 drop_rpglancher
(id)
 
ham_strip_weapon(id"weapon_m249");
 return 
PLUGIN_CONTINUE
}

public 
Event_WeaponDrop (id) {
 
 if(!
is_user_alive(id) || !Has_Bazooka[id])
 return 
PLUGIN_CONTINUE

 
new weaponidclipammo
 weaponid 
get_user_weapon(idclipammo)
 
 if (
weaponid == CSW_M249) {
 
drop_rpglancher(id)
 
ham_strip_weapon(id"weapon_m249");
 }
 else
 return 
PLUGIN_CONTINUE
 
 
return PLUGIN_HANDLED

}
/************************************************************
* GIB FUNCTIONS (made by mike_cao)
************************************************************/

static fx_blood_small (origin[3],num) {
 
 
// Small splash
 
for (new blood_small 0blood_smallnumblood_small++) {
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_WORLDDECAL)
 
write_coord(origin[0]+random_num(-100,100))
 
write_coord(origin[1]+random_num(-100,100))
 
write_coord(origin[2]-36)
 
 if (
is_cstrikewrite_byte(random_num(190,197)) // Blood decals
 
if (!is_cstrikewrite_byte(random_num(202,209)) // Blood decals

 
message_end()
 
 }
 
}

static 
fx_blood_large (origin[3],num) {
 
 
// Large splash
 
for (new blood_large 0blood_large numblood_large++) {
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_WORLDDECAL)
 
write_coord(origin[0] + random_num(-50,50))
 
write_coord(origin[1] + random_num(-50,50))
 
write_coord(origin[2]-36)

 if (
is_cstrikewrite_byte(random_num(204,205)) // Blood decals
 
if (!is_cstrikewrite_byte(random_num(216,217)) // Blood decals
 
 
message_end()
 
 }
 
}

static 
fx_gib_explode (origin[3],num) {
 
 new 
flesh[3], xyz
 flesh
[0] = mdl_gib_flesh
 flesh
[1] = mdl_gib_meat
 flesh
[2] = mdl_gib_legbone
 
 
// Gib explosion
 // Head
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_MODEL)
 
write_coord(origin[0])
 
write_coord(origin[1])
 
write_coord(origin[2])
 
write_coord(random_num(-100,100))
 
write_coord(random_num(-100,100))
 
write_coord(random_num(100,200))
 
write_angle(random_num(0,360))
 
write_short(mdl_gib_head)
 
write_byte(0)
 
write_byte(500)
 
message_end()
 
 
// Spine
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_MODEL)
 
write_coord(origin[0])
 
write_coord(origin[1])
 
write_coord(origin[2])
 
write_coord(random_num(-100,100))
 
write_coord(random_num(-100,100))
 
write_coord(random_num(100,200))
 
write_angle(random_num(0,360))
 
write_short(mdl_gib_spine)
 
write_byte(0)
 
write_byte(500)
 
message_end()
 
 
// Lung
 
for(new Lung 0Lung random_num(1,2); Lung++) {
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_MODEL)
 
write_coord(origin[0])
 
write_coord(origin[1])
 
write_coord(origin[2])
 
write_coord(random_num(-100,100))
 
write_coord(random_num(-100,100))
 
write_coord(random_num(100,200))
 
write_angle(random_num(0,360))
 
write_short(mdl_gib_lung)
 
write_byte(0)
 
write_byte(500)
 
message_end()
 
 }
 
 
// Parts, 5 times
 
for(new Parts 0Parts 5Parts++) {
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_MODEL)
 
write_coord(origin[0])
 
write_coord(origin[1])
 
write_coord(origin[2])
 
write_coord(random_num(-100,100))
 
write_coord(random_num(-100,100))
 
write_coord(random_num(100,200))
 
write_angle(random_num(0,360))
 
write_short(flesh[random_num(0,2)])
 
write_byte(0)
 
write_byte(500)
 
message_end()
 
 }
 
 
// Blood
 
for(new Blood 0Blood numBlood++) {
 
 
random_num(-100,100)
 
random_num(-100,100)
 
random_num(0,100)
 
 for(new 
05j++) {
 
 
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
 
write_byte(TE_BLOODSPRITE)
 
write_coord(origin[0]+(x*j))
 
write_coord(origin[1]+(y*j))
 
write_coord(origin[2]+(z*j))
 
write_short(spr_blood_spray)
 
write_short(spr_blood_drop)
 
write_byte(248)
 
write_byte(15)
 
message_end()
 
 }
 
 }
 

Responder
#2
Lo agregas al principio
Código PHP:
// Limite de Compras
#define MAX_USUARIOS 3
//#define BAZOOKA_RONDA ; Aca si queres que cada ronda se resete el valor para que vuelvan o comprar o que sea por mapa tu lo decides y sacas el //

new g_bazooka_comprada 0

Cambias el event_newround por este

Código PHP:
public Event_NewRound (){
 
#if defined BAZOOKA_RONDA
 
g_bazooka_comprada 0
 
#endif
 
new iCurrent find_ent_by_class(-1"rpgrocket")
 while ((
iCurrent find_ent_by_class(-1"rpgrocket")) != 0) {
 
 new 
id entity_get_edict(iCurrentEV_ENT_owner)
 
remove_missile(id,iCurrent)
 
 }
 

Cambias el cmd_buybazooka por este!

Código PHP:
public cmd_BuyBazooka (id) {
 
 if(!
is_user_alive(id)) 
 
client_print(idprint_center"You cant buy when your dead!")
 else if (
g_bazooka_comprada >= MAX_USUARIOS
 
client_print(idprint_center"Ya se compro muchas bazookas!")
 else if(
cs_get_user_money(id) < get_pcvar_num(cost))
 
client_print(idprint_center"Insuffisant funds, you need %d to buy the bazooka"get_pcvar_num(cost))

 else {
 
drop_primary(id)
 
cs_set_user_money(idcs_get_user_money(id) - get_pcvar_num(cost), 1)
 
wep[id] = give_item(id"weapon_m249");
 
 
Has_Bazooka[id] = true
 entity_set_int
(idEV_INT_weaponanimSEQ_IDLE)
 
Allow_Shooting[id] = true
 
 Bazooka_Ammo
[id] = 5


 client_print
(idprint_chat"[Bazooka] You have successfully bought a bazooka!")
 
client_print(idprint_chat"[Bazooka] What are you going to do now!?")
 
g_bazooka_comprada++
 new 
temp[2], weaponID get_user_weapon(idtemp[0], temp[1])
 
 if(
weaponID == CSW_M249) {//
 
 
Event_CurWeapon(id
 
entity_set_int(idEV_INT_weaponanimSEQ_FIDGET)
 
 }
 
 else {
 
 
client_cmd(id"weapon_m249")
 
 }
 
 
emit_sound(idCHAN_WEAPON"items/gunpickup2.wav"VOL_NORMATTN_NORM0PITCH_NORM)
 
 }

 return 
PLUGIN_HANDLED



Creo que a esto te referias, trata de ser mas especifico
Responder


Salto de foro:


Usuarios navegando en este tema: 1 invitado(s)