Raised This Month: $ Target: $400
 0% 

NS and weapon damage - not working?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
onlysolution
New Member
Join Date: Mar 2005
Old 04-07-2005 , 22:18   NS and weapon damage - not working?
Reply With Quote #1

I am attempting to write a simple joke script at the request of a friend that sets the damage of the welder to absurd levels. After a billion different tries I've come to the conclusion that either ns_set_weap_dmg and ns_get_weap_dmg are completely non working or I am an idiot and I'm hoping someone can tell me which is the case. Here is the last script I tried

Code:
#include <amxmodx>
#include <ns>
#include <amxmisc> 

new PLUGIN[]="Turbowelder"
new AUTHOR[]="Onlysolution"
new VERSION[]="1.00"

public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     register_concmd("amx_turboweld", "cmd_turboweld", ADMIN_RCON, "")
}

public cmd_turboweld(id, level, cid)
{
    if (!cmd_access(id, level, cid, 0)) {
         return PLUGIN_HANDLED
    	} 
  
	new wep = WEAPON_WELDER
	new Float:dmg = 6000.00
	new Float:olddmg = ns_get_weap_dmg(WEAPON_WELDER)

   
        ns_set_weap_dmg(WEAPON_WELDER, dmg)
	server_print ("Weapon %d set to %f damage.", wep, dmg)
	server_print ("Original damage was %f", olddmg)
        server_print ("welder is %d", WEAPON_WELDER)
     

	return PLUGIN_HANDLED
   }
the output of the command is something like (i.e. same number, different number of trailing zeroes) :
Code:
   Weapon 18 set to 6000.0 damage
   Original damage was 0.0
   welder is 18
and the welder does the same amount of damage.

I'm guessing I can't properly program in small and I screwed up a data type or 12 in here.

Thanks in advance!

-Onlysolution
onlysolution is offline
karlos
Veteran Member
Join Date: Apr 2004
Location: Germany/Poland
Old 04-08-2005 , 11:28  
Reply With Quote #2

ns_get_weap_dmg(weapon_ID)/ns_set_weap_dmg(weapon_ID)

u need to give the weapon ID not the weapon number
WEAPON_WELDER is a weapon number

i suggest:
1) cycle through all ents
2) check each ent if its a welder
3) if welder check if it belongs to the player u want to increase damage

now u have the weapon ID and u can use both functions

my gnome plugin is dioing it this way
__________________
alias White Panther
karlos is offline
onlysolution
New Member
Join Date: Mar 2005
Old 04-09-2005 , 04:00  
Reply With Quote #3

Thanks a bunch! The code I wound up using wasn't quite as intense though:

Code:
#include <amxmodx>
#include <ns>
#include <amxmisc> 
#include <engine>

new PLUGIN[]="Turbowelder"
new AUTHOR[]="Onlysolution"
new VERSION[]="1.00"

public plugin_init()
{
     register_plugin(PLUGIN, VERSION, AUTHOR)
     register_concmd("amx_turboweld", "cmd_turboweld", ADMIN_CVAR, "<weapon> <damage>")
}

public cmd_turboweld(id, level, cid)
{
    if (!cmd_access(id, level, cid, 1)) {
         return PLUGIN_HANDLED
    	} 

	new Arg1[24]


	read_argv(1, Arg1, 24)

  
	new target = cmd_target( id, Arg1, 14 )
	new Float:dmg = 6000.0
	new wep = find_ent_by_owner(get_maxplayers(), "weapon_welder", target)
	new Float:olddmg = ns_get_weap_dmg(wep)
   
        ns_set_weap_dmg(wep, dmg)
	server_print ("Weapon %d set to %f damage.", wep, dmg)
	server_print ("Original damage was %f", olddmg)
     

	return PLUGIN_HANDLED
   }
though I'm sure it does exactly the same thing as you suggested, fundamentally.
onlysolution is offline
Reply


Thread Tools
Display Modes

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 10:02.


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