Raised This Month: $12 Target: $400
 3% 

[HL] Give Items and Weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Half-Life        Category:   Admin Commands        Approver:   Emp` (115)
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-24-2009 , 11:24   [HL] Give Items and Weapons
Reply With Quote #1

Half-Life Give Items And Weapons







Description:

With this plugin you can give items or weapons to a specific player.
Already exists a plugin like this here http://forums.alliedmods.net/showthread.php?p=130160 but doesnt have all weapons.


Commands:(ADMIN_LEVEL_A)


- hl_weapon:

- <name> <weapon> - give a weapon
- <name> <@ALL> - give all weapons

- hl_item:

- <name> <item> - give a item
- <name> <@ALL> - give all items


Examples:

hl_weapon tuty egon
hl_item tuty longjump


Info's:


The weapon short names available are:

Code:
crowbar
hivehand
357
python
crossbow
squeak
tripmine
satchel
handgrenade
9mmhandgun
glock
9mmAR
gauss
mp5gun
egon
rpgrocket
shotgun
@ALL
The items short names available are:

Code:
battery
healthkit
longjump
security
antidote
@ALL
Attached Files
File Type: sma Get Plugin or Get Source (HL_GiveWeapons.sma - 5953 views - 10.2 KB)
File Type: sma Get Plugin or Get Source (HL_GiveWeapons_byConnorMcLeod.sma - 3068 views - 4.6 KB)
__________________

Last edited by tuty; 02-26-2010 at 15:09.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 05-24-2009 , 11:27   Re: [HL] Give Items and Weapons
Reply With Quote #2

halflife fan.
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-24-2009 , 12:19   Re: [HL] Give Items and Weapons
Reply With Quote #3

You should try to use another method, like putting all constants in an array and looping. Your code will be reduced, optimized and less code.
Arkshine is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 05-24-2009 , 12:32   Re: [HL] Give Items and Weapons
Reply With Quote #4

A menu would make it easier to use (and let you give bpammo or not), also, if you find HL bpammo offset, you can fire set_pdata_int once instead of multiple give_item natives.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-24-2009 , 12:40   Re: [HL] Give Items and Weapons
Reply With Quote #5

@arkshine - i understand
@ connor - if you can find the bpammo offset would be cool
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-24-2009 , 12:45   Re: [HL] Give Items and Weapons
Reply With Quote #6

A way that you can REALLY reduce the @ALL code is:
Code:
new all = equali(wpnarg, "@ALL"); new chosen = 0; if( all || equal(wpnarg, "_weapon_") ) {     chosen = 1;     // give weapon } if( all || !chosen && equal(wpnarg, "_weapon_2_") ) {     chosen = 1;     // give weapon } if( all || !chosen && equal(wpnarg, "_weapon_3_") ) {     chosen = 1;     // give weapon }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-24-2009 , 12:50   Re: [HL] Give Items and Weapons
Reply With Quote #7

About the offset m_rgAmmo :

Offset 310: 125
Offset 311: 250
Offset 312: 10
Offset 313: 36
Offset 314: 100
Offset 315: 5
Offset 316: 50
Offset 317: 5
Offset 318: 5
Offset 319: 10
Offset 320: 15
Offset 321: 8

You should be able to identify the ammo type used for each offsets.

Last edited by Arkshine; 05-24-2009 at 12:54.
Arkshine is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 05-24-2009 , 15:20   Re: [HL] Give Items and Weapons
Reply With Quote #8

updated.. sugestions are welcome
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
danli
Member
Join Date: Mar 2009
Old 05-24-2009 , 21:24   Re: [HL] Give Items and Weapons
Reply With Quote #9

great plugin. better than the other one. can you change the commands so they are shorter to type?

hl_weapon
hl_item

instead of halflife_giveweapon, etc? Or I guess I could change it myself and recompile it.

Also, alot names dont show up right or are hard to type because people use funny characters/symbols. Can you put something in it so that the player's unique id can be used too?

example: hl_weapon #1347 tripmine

I dont see any need for a menu if you shorten the commands.

EDIT: btw, shouldn't this work with any Half Life mod?

Last edited by danli; 05-24-2009 at 21:33.
danli is offline
AlejandroSk
BANNED
Join Date: Nov 2008
Location: Aqui, en mi casa. Karma:
Old 05-24-2009 , 21:50   Re: [HL] Give Items and Weapons
Reply With Quote #10

Why not use

Code:
switch(wpnarg)

?
AlejandroSk is offline
Send a message via MSN to AlejandroSk
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 19:12.


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