Hello, I have been modifying a plugin (what else do I do) by Blue Raja recently because it sparked an idea I had many of years ago, balancing all those crappy never used guns in CS. When I get it working, I will input the commands and abilities to edit any guns through cvars, but right now, I have a problem:
For some reason (even though I took out all the specific admin targeted damage multipliers, it is still (i think) doubling the damage from each gun from every player. They are even stronger if they are a gun on the list below (multiplying from a multiplier).
Can somebody point to the code that I missed to remove? I have been looking and tweaking for half an hour, and I can't see anything.
NOTE TO BLUE RAJA: If you don't want me to release this plugin, just say so, but it would be nice if you could help me with this, for my server.
Code:
/************************************************
Damage Modify
Author: TaRgEt*TuRkEy (Code From Blue Raja)
Version: 1.0
Mod: Counter-Strike
Requires: AMX Mod X v1.0
Description:
Allows admins to set the multiplier for each
weapon in counterstrike. You can set values
to 0, to have the gun do no damage, or even
negative values to inflict health into the
victim.
Notes:
90% of this code is from Blue Raja's plugin,
Damage Multiplier (WC3). Located here:
<a href="http://forums.alliedmods.net/showthread.php?t=8437" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?t=8437</a>
I got the idea many years ago when I seen how
little the crappy guns in cs were used because,
well... they suck. You can fix that with this
plugin.
************************************************/
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <engine>
#include <fun>
new Title[32] = "Damage Modify"
new Version[32] = "1.0.0"
new Author[16] = "TaRgEt*TuRkEy"
new gmsgDeathMsg
new gmsgScoreInfo
new DeathHandled[33]
public client_connect(id)
{
DeathHandled[id]=false
}
public RoundStart()
{
new Float:roundtime = get_cvar_float("mp_roundtime") * 60.0
new rtime = read_data(1)
if ( roundtime == rtime ) { //Roundstart after freezetime
for (new i=0; i<33; i++){
DeathHandled[i]=false
}
}
return PLUGIN_CONTINUE
}
public damage_event(id)
{
new weapon, bodypart, attacker = get_user_attacker(id,weapon,bodypart)
new damage
//If death has already been handled, return
if(DeathHandled[id])
return PLUGIN_CONTINUE
//Is called for all players, regardless of admin status
//In case player died "legitimately"
if (!is_user_alive(id))
{
DeathHandled[id]=true
return PLUGIN_CONTINUE
}
if (attacker==0)
return PLUGIN_CONTINUE
if (attacker==id && weapon==0)
return PLUGIN_CONTINUE
//Check is victim and attacker are dead
new victimkilled = 0
new victimhealth = get_user_health(id)
//Check if shot was headshot; might want to fake it, if not
new headshot = 0
if (bodypart==HIT_HEAD || //real headshot
(damage>35 && weapon!=CSW_HEGRENADE && bodypart==HIT_CHEST)) //fake headshot ^_^
headshot=1
damage = read_data(2)
if (weapon==CSW_P228)
damage = floatround(float(damage)*1.3)
if (weapon==CSW_MAC10)
damage = floatround(float(damage)*1.5)
if (weapon==CSW_GLOCK18)
damage = floatround(float(damage)*1.1)
if (weapon==CSW_ELITE)
damage = floatround(float(damage)*1.6)
if (weapon==CSW_FIVESEVEN)
damage = floatround(float(damage)*1.3)
if (weapon==CSW_UMP45)
damage = floatround(float(damage)*1.3)
if (weapon==CSW_TMP)
damage = floatround(float(damage)*1.6)
if (weapon==CSW_P90)
damage = floatround(float(damage)*1.2)
//check if player should die; if so, kill 'em
if (victimhealth - damage<=0)
victimkilled = 1
if (victimhealth - damage<=1024 && get_user_health(id)>500)
victimkilled = 1
if (victimkilled){
new weaponname[32]
switch (weapon)
{
case 1:
weaponname = "p228"
case 3:
weaponname = "scout"
case 4:
weaponname = "grenade"
case 5:
weaponname = "xm1014"
case 7:
weaponname = "mac10"
case 8:
weaponname = "aug"
case 10:
weaponname = "elite"
case 11:
weaponname = "fiveseven"
case 12:
weaponname = "ump45"
case 13:
weaponname = "sg550"
case 14:
weaponname = "galil"
case 15:
weaponname = "famas"
case 16:
weaponname = "usp"
case 17:
weaponname = "glock18"
case 18:
weaponname = "awp"
case 19:
weaponname = "mp5navy"
case 20:
weaponname = "m249"
case 21:
weaponname = "m3"
case 22:
weaponname = "m4a1"
case 23:
weaponname = "tmp"
case 24:
weaponname = "g3sg1"
case 26:
weaponname = "deagle"
case 27:
weaponname = "sg552"
case 28:
weaponname = "ak47"
case 29:
weaponname = "knife"
case 30:
weaponname = "p90"
}
if (get_user_team(id)!=get_user_team(attacker)){
set_user_frags(id,get_user_frags(id)+1)
set_user_frags(attacker,get_user_frags(attacker)+1)
}
else{
set_user_frags(id,get_user_frags(id)+1)
set_user_frags(attacker,get_user_frags(attacker)-1)
}
//Kill victim
set_msg_block(gmsgDeathMsg,BLOCK_ONCE)
set_user_health(id,-1)
set_msg_block(gmsgDeathMsg,BLOCK_NOT) //having problems with more than one message being blocked :S
//Display death
message_begin( MSG_ALL, gmsgDeathMsg,{0,0,0},0)
write_byte(attacker)
write_byte(id)
write_byte(headshot)
write_string(weaponname)
message_end()
//Change scoreboard for victim
message_begin(MSG_ALL, gmsgScoreInfo)
write_byte(id) //Player
write_short(get_user_frags(id)) //Frags
write_short(cs_get_user_deaths(id)) //Deaths
write_short(0) //"Class"
write_short(get_user_team(id)) //Team
message_end()
//Change scoreboard for attacker
message_begin(MSG_ALL, gmsgScoreInfo)
write_byte(attacker) //Player
write_short(get_user_frags(attacker)) //Frags
write_short(cs_get_user_deaths(attacker)) //Deaths
write_short(0) //"Class"
write_short(get_user_team(attacker)) //Team
message_end()
//Don't handle this death again
DeathHandled[id]=true
}
else {
set_user_health(id,get_user_health(id) - damage)
}
return PLUGIN_CONTINUE
}
public plugin_init(){
gmsgDeathMsg = get_user_msgid("DeathMsg")
gmsgScoreInfo = get_user_msgid("ScoreInfo")
register_plugin(Title,Version,Author)
register_event("Damage", "damage_event", "b", "2!0")
register_event("RoundTime", "RoundStart", "bc")
return PLUGIN_CONTINUE
}
__________________