Raised This Month: $ Target: $400
 0% 

Need help with a little NS script...


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 12:09   Need help with a little NS script...
Reply With Quote #1

Hey what im trying to make is a plugin that gives a HMG to a player. When i try to compile this, it comes "argument mismatch" or something. Come somebody help me? Avalanche??? hehe Here it is:
Code:
#include <amxmodx> #include <amxmisc> #include <ns> public plugin_init() {     register_plugin("Weapon Giver (Marines)", "1.0", "XunTric")     register_concmd("amx_hmg", "hmg", ADMIN_KICK, "<name> Gives a player a HMG") } public hmg(id,level,cid) {         if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     ns_give_item(player, WEAPON_HMG)     client_print(player, print_chat, "The admin gave you a HMG")              return PLUGIN_HANDLED }
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2005 , 15:00  
Reply With Quote #2

What is the point of getting their username? You don't use it.

Anyway, the ns_give_item function accepts a string as the last parameter. It should be the classname of the entity you wish to give. Try this:

Code:
ns_give_item(player,"weapon_hmg")
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 15:14  
Reply With Quote #3

It worked! Thanks. Im making a "All in one" with all weapons hehe.
But i still get a "loose indentation" (or what its called ) warning. How do i get this away?
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2005 , 15:19  
Reply With Quote #4

It's your last PLUGIN_HANDLED that isn't aligned with the other stuff.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 17:00  
Reply With Quote #5

I dont understand... Use PLUGIN_CONTINUE instead then? Anyway it didnt work. It comes "cant create enitity WEAPON_HMG" or something like that when i try to use the command... Could you help me with that too??
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2005 , 18:45  
Reply With Quote #6

Turns out you have to use "weapon_heavymachinegun". These are the names:

weapon_machinegun : Machine gun
weapon_pistol : Pistol
weapon_heavymachinegun : Heavy machine gun
weapon_grenadegun : Grenade launcher
weapon_shotgun : Shotgun
weapon_welder : Welder
weapon_mine : Pack of mines

item_health : Health pack
item_genericammo : Ammo
item_jetpack : Jetpack
item_heavyarmor : Heavy armor
item_mine : Deployed mine

As for the indentation warning, let's take a look:

Code:
#include <amxmodx> #include <amxmisc> #include <ns> public plugin_init() {     register_plugin("Weapon Giver (Marines)", "1.0", "XunTric")     register_concmd("amx_hmg", "hmg", ADMIN_KICK, "<name> Gives a player a HMG") } public hmg(id,level,cid) {         if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     ns_give_item(player, "weapon_heavymachinegun")     client_print(player, print_chat, "The admin gave you a HMG")           // NOTICE HOW ns_give_item and client_print are aligned     // if you look at return PLUGIN_HANDLED, you will see it isn't:          return PLUGIN_HANDLED     // So align it properly:     return PLUGIN_HANDLED }
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-25-2005 , 12:39  
Reply With Quote #7

Omg how do you know all stuff? Thanks..
XunTric is offline
Freecode
Never Fall Asleep
Join Date: Jan 2004
Old 02-25-2005 , 12:45  
Reply With Quote #8

http://forums.alliedmods.net/showthread.php?t=6481
Freecode is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-25-2005 , 13:01  
Reply With Quote #9

Thanks freecode reading it now
Download my plugin here
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-25-2005 , 16:54  
Reply With Quote #10

How do I know the names of the items? I took a look at the ns.fgd that comes with Natural Selection.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX 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 13:57.


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