//find what weapon type the player has
switch(get_user_weapon(player))
{
case CSW_P228 : ca = 13;
case CSW_SCOUT : ca = 10;
case CSW_HEGRENADE : ca = 1;
case CSW_XM1014 : ca = 7;
case CSW_C4 : ca = 1;
case CSW_MAC10 : ca = 30;
case CSW_AUG : ca = 30;
case CSW_SMOKEGRENADE : ca = 1;
case CSW_ELITE : ca = 15;
case CSW_FIVESEVEN : ca = 20;
case CSW_UMP45 : ca = 25;
case CSW_SG550 : ca = 30;
case CSW_GALI : ca = 35;
case CSW_FAMAS : ca = 25;
case CSW_USP : ca = 12;
case CSW_GLOCK18 : ca = 20;
case CSW_AWP : ca = 10;
case CSW_MP5NAVY : ca = 30;
case CSW_M249 : ca = 100;
case CSW_M3 : ca = 8;
case CSW_M4A1 : ca = 30;
case CSW_TMP : ca = 30;
case CSW_G3SG1 : ca = 20;
case CSW_FLASHBANG : ca = 2;
case CSW_DEAGLE: ca = 7;
case CSW_SG552 : ca = 30;
case CSW_AK47 : ca = 30;
case CSW_P90 : ca = 50;
}
so when you use first plugin, the first plugin sets more ammo to the clip, but second one sets back the clip to normal limits, e.g. first plugin makes ak47 ammo 45, second plugin makes it back to 30, and just adds the ammo from there when you shoot. Anybody know what to do? need to make these plugins not collide somehow
#include <superheromod>
new gHasHero[SH_MAXSLOTS+1]
new const gHeroName[] = "Punisher"
new gHeroID
new pcvarAmmoToAdd
public plugin_init()
{
register_plugin("SUPERHERO PunisherV2", "1.2", "Jelle")
//cvars
new pcvarLevel = register_cvar("punisherv2_level", "11")
pcvarAmmoToAdd = register_cvar("punisherv2_ammotoadd", "5")
new pcvarTimeToAdd = register_cvar("punisherv2_ammotime", "1.0")
//create hero
gHeroID = sh_create_hero(gHeroName, pcvarLevel)
sh_set_hero_info(gHeroID, "Ammo adder", "Adds 5 ammo every sec, clips nearly twice as long.")
set_task(get_pcvar_float(pcvarTimeToAdd), "add_bullets", _, _, _, "b")
}
public sh_hero_init(id, heroID, mode)
{
if ( gHeroID != heroID ) return
gHasHero[id] = mode ? true : false
}
public add_bullets()
{
if ( !sh_is_active() ) return
static players[32], playerCount, player, i
get_players(players, playerCount, "ah")
for ( i = 0; i < playerCount; i++ )
{
player = players[i]
if ( gHasHero[player] )
{
new ca
//find what weapon type the player has
switch(get_user_weapon(player))
{
case CSW_P228 : ca = 13;
case CSW_SCOUT : ca = 10;
case CSW_HEGRENADE : ca = 1;
case CSW_XM1014 : ca = 7;
case CSW_C4 : ca = 1;
case CSW_MAC10 : ca = 30;
case CSW_AUG : ca = 30;
case CSW_SMOKEGRENADE : ca = 1;
case CSW_ELITE : ca = 15;
case CSW_FIVESEVEN : ca = 20;
case CSW_UMP45 : ca = 25;
case CSW_SG550 : ca = 30;
case CSW_GALI : ca = 35;
case CSW_FAMAS : ca = 25;
case CSW_USP : ca = 12;
case CSW_GLOCK18 : ca = 20;
case CSW_AWP : ca = 10;
case CSW_MP5NAVY : ca = 30;
case CSW_M249 : ca = 100;
case CSW_M3 : ca = 8;
case CSW_M4A1 : ca = 30;
case CSW_TMP : ca = 30;
case CSW_G3SG1 : ca = 20;
case CSW_FLASHBANG : ca = 2;
case CSW_DEAGLE: ca = 7;
case CSW_SG552 : ca = 30;
case CSW_AK47 : ca = 30;
case CSW_P90 : ca = 50;
}
new currentAmmo = cs_get_weapon_ammo(get_pdata_cbase( player, 373 ))
new newAmmo = currentAmmo+get_pcvar_num(pcvarAmmoToAdd)
//This checks if ca is higher or the equal to the new ammo which will be set
if (newAmmo <= ca)
{
//Now lets set the new ammo!
cs_set_weapon_ammo(get_pdata_cbase( player, 373 ), newAmmo)
}
//what if ca = 30, and new ammo is bigger than the max? then new ammo will be 32 in a 30 max clip weapon??
else
{
//Then we just set the max bullets into the gun!
cs_set_weapon_ammo(get_pdata_cbase( player, 373 ), ca)
}
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1030\\ f0\\ fs16 \n\\ par }
*/
Thank you.
__________________
ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
1) Just why? If a player has Punisher, they have effectively infinite ammo...who cares if you have a larger clip?
2) This is not so much a bug, but a code collision.
I didn't look super hard, but make sure the number tables in both scripts share the same values.
The values you punch in for trigger, you should make the same changes to the punisher script.
This should make punisher aware of the newer, bigger clip sizes initiated by trigger.
1) Just why? If a player has Punisher, they have effectively infinite ammo...who cares if you have a larger clip?
2) This is not so much a bug, but a code collision.
I didn't look super hard, but make sure the number tables in both scripts share the same values.
The values you punch in for trigger, you should make the same changes to the punisher script.
This should make punisher aware of the newer, bigger clip sizes initiated by trigger.
1) The version of punisher I use adds ammo every second instead of just spray non stop. I still want there to be a reload time, so with bigger ammo clips you can shoot longer without reload.
2) Yes, one code sets ammo as 45 and other code sets it back to 30 and they keep fighting.
Think you can do it? I don't have much of an idea of how I would do this.
__________________
ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!
//Punisher
case CSW_P228 : ca = 13;
case CSW_SCOUT : ca = 10;
case CSW_HEGRENADE : ca = 1;
case CSW_XM1014 : ca = 7;
case CSW_C4 : ca = 1;
case CSW_MAC10 : ca = 30;
case CSW_AUG : ca = 30;
case CSW_SMOKEGRENADE : ca = 1;
case CSW_ELITE : ca = 15;
case CSW_FIVESEVEN : ca = 20;
case CSW_UMP45 : ca = 25;
case CSW_SG550 : ca = 30;
case CSW_GALI : ca = 35;
case CSW_FAMAS : ca = 25;
case CSW_USP : ca = 12;
case CSW_GLOCK18 : ca = 20;
case CSW_AWP : ca = 10;
case CSW_MP5NAVY : ca = 30;
case CSW_M249 : ca = 100;
case CSW_M3 : ca = 8;
case CSW_M4A1 : ca = 30;
case CSW_TMP : ca = 30;
case CSW_G3SG1 : ca = 20;
case CSW_FLASHBANG : ca = 2;
case CSW_DEAGLE: ca = 7;
case CSW_SG552 : ca = 30;
case CSW_AK47 : ca = 30;
case CSW_P90 : ca = 50;
//Punisher
case CSW_P228 : ca = 13;
case CSW_SCOUT : ca = 10;
case CSW_HEGRENADE : ca = 1;
case CSW_XM1014 : ca = 7;
case CSW_C4 : ca = 1;
case CSW_MAC10 : ca = 30;
case CSW_AUG : ca = 30;
case CSW_SMOKEGRENADE : ca = 1;
case CSW_ELITE : ca = 15;
case CSW_FIVESEVEN : ca = 20;
case CSW_UMP45 : ca = 25;
case CSW_SG550 : ca = 30;
case CSW_GALI : ca = 35;
case CSW_FAMAS : ca = 25;
case CSW_USP : ca = 12;
case CSW_GLOCK18 : ca = 20;
case CSW_AWP : ca = 10;
case CSW_MP5NAVY : ca = 30;
case CSW_M249 : ca = 100;
case CSW_M3 : ca = 8;
case CSW_M4A1 : ca = 30;
case CSW_TMP : ca = 30;
case CSW_G3SG1 : ca = 20;
case CSW_FLASHBANG : ca = 2;
case CSW_DEAGLE: ca = 7;
case CSW_SG552 : ca = 30;
case CSW_AK47 : ca = 30;
case CSW_P90 : ca = 50;
Ok now lets say I pick m4a1, I have 30 ammo, after few seconds punisher adds it up to 45, it doesn't stop at 30. So trigger is useless now, because punisher kind of has that superhero now.
__________________
ANY SCRIPTER ON THIS FORUM HAS FREE VIP/ADMIN IN MY SERVER!