Raised This Month: $ Target: $400
 0% 

[NS] Super welder


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DTE
Junior Member
Join Date: Nov 2006
Old 02-15-2007 , 19:46   [NS] Super welder
Reply With Quote #1

I'm trying to give the welder a player is carrying a high rate of damage, but I can't get my script working. It keeps dealing the standard damage...
Can anybody see what I'm doing wrong?

Code:
new max_player_num, max_entities
max_player_num = get_maxplayers()
max_entities = get_global_int(GL_maxEntities)
new Float:dmg = 6000.0
new weap = max_player_num + 1; weap <= max_entities; ++weap
ns_set_weap_dmg(weap, dmg)
DTE is offline
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-15-2007 , 19:49   Re: [NS] Super welder
Reply With Quote #2

If I'm correct:

PHP Code:
 new weap max_player_num 1weap <= max_entities; ++weap 
Should Be:

PHP Code:
 new weapon max_player_num 1weapon <= max_entities; +weapon 
COPY AND PASTE YOUR FULL CODE
FormulaZero is offline
DTE
Junior Member
Join Date: Nov 2006
Old 02-15-2007 , 20:29   Re: [NS] Super welder
Reply With Quote #3

It part of the roll the dice script from White Panther. I'm trying to add the super welder to it. This is the complete roll option.

Code:
}else if ( diceroll == 21 )
 {
  if ( class == CLASS_MARINE || class == CLASS_JETPACK || class == CLASS_HEAVY || class == CLASS_COMMANDER )
  {
   if (!ns_has_weapon(id, WEAPON_WELDER))
   {
    give_item(id, "weapon_welder")
    print_to_client("RTD >> %s has won a welder!", User)
   }else {
    new max_player_num, max_entities
    max_player_num = get_maxplayers()
    max_entities = get_global_int(GL_maxEntities)
    new Float:dmg = 6000.0
    new weap = max_player_num + 1; weap <= max_entities; ++weap
    ns_set_weap_dmg(weap, dmg) 
    print_to_client("RTD >> %s has won a super welder!", User)
   }
  }else
  {
   new randnum = random(2)
   if ( randnum == 0 && !ns_has_weapon(id, WEAPON_HEALINGSPRAY))
   {
    give_item(id, "weapon_healingspray")
   }else if (!ns_has_weapon(id, WEAPON_UMBRA))
   {
    give_item(id, "weapon_umbra")
   }else
   {
    // already has Healspray or Umbra
    roll_the_dice(id)
    return PLUGIN_HANDLED
   }
  }
  //print_to_client("RTD >> %s has been given revitalizing weapons!", User)
 }
DTE is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 02-15-2007 , 20:38   Re: [NS] Super welder
Reply With Quote #4

Quote:
Originally Posted by FormulaZero View Post
If I'm correct:

PHP Code:
 new weap max_player_num 1weap <= max_entities; ++weap 
Should Be:

PHP Code:
 new weapon max_player_num 1weapon <= max_entities; +weapon 
COPY AND PASTE YOUR FULL CODE
You would be incorrect. Please don't post advice if you, at the very least, don't even know what the (prefix) increment operator is.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
sawce
The null pointer exception error and virtual machine bug
Join Date: Oct 2004
Old 02-15-2007 , 22:39   Re: [NS] Super welder
Reply With Quote #5

Your code doesn't make much sense.

I've never tested changing damage on the welder, so this may only change the actual damage output and not the repair rate. The func_weldable opening rate most likely would not be altered also, as that is stored as a "seconds to weld to open" value, not a "welder damage required to open" value.

something like this:
Code:
new welderid=0;

while ((welderid=find_ent_by_class(welderid,"weapon_welder"))!=0)
{
  if (entity_get_edict(welderid,EV_ENT_owner)==id)
  {
    break;
  }
}

if (welderid==0)
{
  // could not find the welderid, get out of here
  return 0;
}
ns_set_weap_dmg(welderid,dmg);
sawce is offline
FormulaZero
BANNED
Join Date: Feb 2007
Location: Sector 7G
Old 02-15-2007 , 23:42   Re: [NS] Super welder
Reply With Quote #6

Yeah that's correct sawce I was about to post something similar. =)
FormulaZero is offline
DTE
Junior Member
Join Date: Nov 2006
Old 02-16-2007 , 07:12   Re: [NS] Super welder
Reply With Quote #7

Tkx guys
And yes it's only the intention to change the damange and not the repair rate. I just had problems with getting the weaponindex :/

edit: It works
Many thanks

Last edited by DTE; 02-16-2007 at 07:25.
DTE is offline
Greenberet
AMX Mod X Beta Tester
Join Date: Apr 2004
Location: Vienna
Old 02-16-2007 , 08:02   Re: [NS] Super welder
Reply With Quote #8

this would be a better way
Code:
new welderid=0; while ((welderid=find_ent_by_class(welderid,"weapon_welder"))!=0) {   if (entity_get_edict(welderid,EV_ENT_owner)==id)   {     ns_set_weap_dmg(welderid,dmg);   } }
Greenberet is offline
Send a message via ICQ to Greenberet Send a message via MSN to Greenberet
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 00:34.


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