Archived copy of war3source.com, the War3Source forum (2009–2020), rebuilt from the Internet Archive by wc3mods.net. This page was captured on 2012-09-22 (original capture). Forum · All archived topics · Wiki · Bug tracker · Blog
Chat

War3:Source
September 21, 2012, 09:41:52 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Download: http://war3source.com/index.php?board=9.0
What is War3Source?: http://war3source.com/index.php?topic=200.0
Sample Stats: http://war3source.com/war3stats
Steam Community Group: http://steamcommunity.com/groups/war3source
War3Source SVN Checkout: http://ownageclan.com/svn/war3source/
War3Source servers: http://www.game-monitor.com/search.php?vars=war3_version=
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: [Packaged] Ammo Control Plugin  (Read 1167 times)
Frenzzy
Full Member
***
Posts: 217


337905984 frenzzy@live.ru
View Profile WWW
« on: December 16, 2010, 02:32:39 PM »

War3Source Addon - Ammo Control

Read the natives description for more information about this addon...
Supported only CSS game mod.

Servers running this addon: http://www.game-monitor.com/AmmoControl

Convars:

Plugin version. Don't change this.

war3_ammocontrol_version "1.2"

Enable / Disable Ammo Control.

war3_ammocontrol_enable "1"


Natives:

/**
 * Give ammo and/or clip for player's weapon.
 *
 * @param client: Client Index. Must be valid.
 * @param weapon: Weapon Index. Must be valid.
 * @param ammo: Amount of Ammo. Optional value. Use -1 to leave as it is.
 * @param clip: Amount of Clip. Optional value. Use -1 to leave as it is.
 * @noreturn
 */


native War3_GiveWeaponAmmo(client, weapon, ammo = -1, clip = -1);

/**
 * Set Ammo Control for player.
 * Auto control for the specified amount of ammo and the ammo in the clip after a buy (rebuy and autobuy) or reload.
 * Does not set an ammo and a clip, when GivePlayerItem used. Changes an ammo and/or a clip with a War3_GiveWeaponAmmo after a GivePlayerItem.
 * Also it does not give ammo, when player picks-up and gets the specified weapon from another player.
 *
 * @param client: Client Index. Use only this parameter to reset the ammo and the clip to deafult.
 * @param weapon: Weapon Name. Optional value. You can use these values instead of weapon names: weapon_primary, weapon_secondary, weapon_grenade or weapon_all.
 * @param ammo: Amount of Ammo. Optional value. Use -1 to leave as it is.
 * @param clip: Amount of Clip. Optional value. Use -1 to leave as it is.
 * @param update: Immediately Update. Optional value. Immediately ammo and/or clip update, if player is alive and has specified weapon(s).
 * @noreturn
 */


native War3_SetAmmoControl(client, String:weapon[], ammo = -1, clip = -1, bool:update = false);


Changelist:

  • 1.0 - Initial release.
  • 1.1 - Added a small check for clean log (without errors).
  • 1.2 - Buy ammo allowed only in buy zone.


P.S.: If you know how to make this addon is easier, please let me know.
« Last Edit: April 22, 2011, 04:00:30 AM by Frenzzy » Logged

O_o
Frenzzy
Full Member
***
Posts: 217


337905984 frenzzy@live.ru
View Profile WWW
« Reply #1 on: December 16, 2010, 02:33:07 PM »

A simple example of using this addon (conditional code):

Quote

// ... some code ...

#include "W3SIncs/AmmoControl" // Added

// ... some code ...

public OnRaceSelected(client, newrace)
{
    if (newrace == thisRaceID)
    {
        War3_SetAmmoControl(client, "weapon_awp", _, 5); // Set Ammo Control (set amount of ammo in the clip to 5)
        // or War3_SetAmmoControl(client, "weapon_awp", -1, 5, false);
    }
    else
    {
        War3_SetAmmoControl(client, ""); // Disable Ammo Control (set amount of ammo in the clip to deafult for awp - 10)
        // or War3_SetAmmoControl(client, "", -1, -1, false);
    }
}

public OnUltimateCommand(client, race, bool:pressed)
{
    // ... some code, checks, ect ...

    new iWeapon = GivePlayerItem(client, "weapon_awp");
    if ((iWeapon != -1) && IsValidEntity(iWeapon))
    {
        War3_GiveWeaponAmmo(client, iWeapon, _, 5); // Set amount of ammo in the clip to 5
        // or War3_GiveWeaponAmmo(client, iWeapon, -1, 5);
    }
}

// ... some code ...



Or you can use this little plugin to test a Ammo Control: War3Source Addon - Ammo Control Commands.
This plugin has only two admin commands that use main "Ammo Control" addon:

war3_giveammo <#userid|name> <ammo> [clip]
war3_weaponammo <#userid|name> [weapon] [ammo] [clip]



P.S.: Sorry for double posting Grin
« Last Edit: December 16, 2010, 03:16:02 PM by Frenzzy » Logged

O_o
Schmarotzer
Full Member
***
Posts: 189


Ich schmarotze dich!

258631507
View Profile WWW
« Reply #2 on: April 14, 2012, 01:18:14 PM »

I think that shotguns doesn't supported
Logged

Welcome to my server
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!