Raised This Month: $ Target: $400
 0% 

[Request] Custom hit dmg


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tonkata245
Member
Join Date: Aug 2020
Location: Mars
Old 01-23-2022 , 14:55   [Request] Custom hit dmg
Reply With Quote #1

Hi, I would like to make a plugin that can put a certain dmg on the T and CT teams (from 1dmg to 100dmg per stroke)

Dmg to be for a knife
this plugin will work constantly (can be setup and without the commands below)


be able to be determined by a command (amx_dmgctset /amx_dmgtset)

used mod
https://www.amxx-bg.info/forum/viewt...hp?f=96&t=2420

Last edited by tonkata245; 01-23-2022 at 15:49.
tonkata245 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-23-2022 , 15:56   Re: [Request] Custom hit dmg
Reply With Quote #2

Code:
#include <amxmodx> #include <amxmisc> #include <cromchat> #include <cstrike> #include <hamsandwich> #if !defined MAX_NAME_LENGTH const MAX_NAME_LENGTH = 32 #endif new Float:g_fCustomDamage[CsTeams] public plugin_init() {     register_plugin("Custom Knife Damage", "1.0", "OciXCrom")     RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)     register_concmd("amx_dmgtset",  "Cmd_SetDamage", ADMIN_BAN, "<damage amount|reset> -- change Terrorists' knife damage")     register_concmd("amx_dmgctset", "Cmd_SetDamage", ADMIN_BAN, "<damage amount|reset> -- change Counter-Terrorists' knife damage")     CC_SetPrefix("&x04[Custom Knife Damage]") } public Cmd_SetDamage(id, iLevel, iCid) {     if(!cmd_access(id, iLevel, iCid, 2))     {         return PLUGIN_HANDLED     }     new szCommand[10]     read_argv(0, szCommand, charsmax(szCommand))     new CsTeams:iTeam = szCommand[7] == 'c' ? CS_TEAM_CT : CS_TEAM_T     new szDamage[5]     read_argv(1, szDamage, charsmax(szDamage))     new Float:fDamage = str_to_float(szDamage)     g_fCustomDamage[iTeam] = fDamage     if(id)     {         new szName[MAX_NAME_LENGTH]         get_user_name(id, szName, charsmax(szName))         if(fDamage > 0.0)         {             CC_SendMessage(0, "&x03%s &x01set knife damage for &x04%s &x01 to &x04%.0f", szName, iTeam == CS_TEAM_CT ? "Counter-Terrorists" : "Terrorists", fDamage)         }         else         {             CC_SendMessage(0, "&x03%s &x01reset knife damage for &x04%", szName, iTeam == CS_TEAM_CT ? "Counter-Terrorists" : "Terrorists")         }     }     return PLUGIN_HANDLED } public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits) {     if(is_user_connected(iAttacker) && iAttacker == iInflictor && get_user_weapon(iAttacker) == CSW_KNIFE)     {         new Float:fNewDamage = g_fCustomDamage[cs_get_user_team(iAttacker)]         if(fNewDamage > 0.0)         {             SetHamParamFloat(4, fNewDamage)         }     } }
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
tonkata245
Member
Join Date: Aug 2020
Location: Mars
Old 01-23-2022 , 16:00   Re: [Request] Custom hit dmg
Reply With Quote #3

Thanks I will check it tomorrow
tonkata245 is offline
tonkata245
Member
Join Date: Aug 2020
Location: Mars
Old 01-24-2022 , 02:17   Re: [Request] Custom hit dmg
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
Code:
#include <amxmodx> #include <amxmisc> #include <cromchat> #include <cstrike> #include <hamsandwich> #if !defined MAX_NAME_LENGTH const MAX_NAME_LENGTH = 32 #endif new Float:g_fCustomDamage[CsTeams] public plugin_init() {     register_plugin("Custom Knife Damage", "1.0", "OciXCrom")     RegisterHam(Ham_TakeDamage, "player", "PreTakeDamage", 0)     register_concmd("amx_dmgtset",  "Cmd_SetDamage", ADMIN_BAN, "<damage amount|reset> -- change Terrorists' knife damage")     register_concmd("amx_dmgctset", "Cmd_SetDamage", ADMIN_BAN, "<damage amount|reset> -- change Counter-Terrorists' knife damage")     CC_SetPrefix("&x04[Custom Knife Damage]") } public Cmd_SetDamage(id, iLevel, iCid) {     if(!cmd_access(id, iLevel, iCid, 2))     {         return PLUGIN_HANDLED     }     new szCommand[10]     read_argv(0, szCommand, charsmax(szCommand))     new CsTeams:iTeam = szCommand[7] == 'c' ? CS_TEAM_CT : CS_TEAM_T     new szDamage[5]     read_argv(1, szDamage, charsmax(szDamage))     new Float:fDamage = str_to_float(szDamage)     g_fCustomDamage[iTeam] = fDamage     if(id)     {         new szName[MAX_NAME_LENGTH]         get_user_name(id, szName, charsmax(szName))         if(fDamage > 0.0)         {             CC_SendMessage(0, "&x03%s &x01set knife damage for &x04%s &x01 to &x04%.0f", szName, iTeam == CS_TEAM_CT ? "Counter-Terrorists" : "Terrorists", fDamage)         }         else         {             CC_SendMessage(0, "&x03%s &x01reset knife damage for &x04%", szName, iTeam == CS_TEAM_CT ? "Counter-Terrorists" : "Terrorists")         }     }     return PLUGIN_HANDLED } public PreTakeDamage(iVictim, iInflictor, iAttacker, Float:fDamage, iDamageBits) {     if(is_user_connected(iAttacker) && iAttacker == iInflictor && get_user_weapon(iAttacker) == CSW_KNIFE)     {         new Float:fNewDamage = g_fCustomDamage[cs_get_user_team(iAttacker)]         if(fNewDamage > 0.0)         {             SetHamParamFloat(4, fNewDamage)         }     } }
There is one problem
On each new map, the default damage is changed
Is there a way to save it for each map (maybe without commands)
For CT (45dmg and For T 35dmg)

Last edited by tonkata245; 01-24-2022 at 02:17.
tonkata245 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 01-24-2022 , 13:41   Re: [Request] Custom hit dmg
Reply With Quote #5

I don't see a problem. You clearly said you wanted a command, not a cvar.
Add the command and value in configs/amxx.cfg.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode