AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [NS] Super welder (https://forums.alliedmods.net/showthread.php?t=51321)

DTE 02-15-2007 19:46

[NS] Super welder
 
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)


FormulaZero 02-15-2007 19:49

Re: [NS] Super welder
 
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

DTE 02-15-2007 20:29

Re: [NS] Super welder
 
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)
 }


Zenith77 02-15-2007 20:38

Re: [NS] Super welder
 
Quote:

Originally Posted by FormulaZero (Post 440841)
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.

sawce 02-15-2007 22:39

Re: [NS] Super welder
 
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);


FormulaZero 02-15-2007 23:42

Re: [NS] Super welder
 
Yeah that's correct sawce I was about to post something similar. =)

DTE 02-16-2007 07:12

Re: [NS] Super welder
 
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 :D
Many thanks

Greenberet 02-16-2007 08:02

Re: [NS] Super welder
 
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);   } }


All times are GMT -4. The time now is 00:34.

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