This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

NS health and ammo drop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rorthic
Junior Member
Join Date: Apr 2005
Old 04-30-2005 , 23:35   NS health and ammo drop
Reply With Quote #1

im trying to create a plugin that will drop health and ammo and take away the appropriate amount of res from the marine team. Im new at this, first plugin. Heres what i have so far:

Code:
#include <amxmodx> #include <amxmisc> #include <fun> //#include <ns> public plugin_init() {     register_plugin("Ns_medpack Giver","1.0","Rorthic")     register_cvar("ns_medpack_enable","1")     register_clcmd("say_team /medpack", "med")     register_clcmd("say /medpack", "med")     register_clcmd("say_team /health", "med")     register_clcmd("say /health", "med")     register_clcmd("say_team /ammo", "ammo")     register_clcmd("say /ammo", "ammo")     } public plugin_modules() {     require_module("fun") } public ammo(id) //not working for some reason, dosent give the ammo {         if(get_cvar_num("ns_medpack_enable")==1)     {             new item[33]             item = "item_genericammo"   //             give_item(id,item)             return PLUGIN_HANDLED             }     else if(get_cvar_num("ns_medpack_enable")==0)         client_print(id,print_console,"[NS Give medpack]This plugin is disable. Set ns_medpack_enable to 1 to re-enable.")     return PLUGIN_CONTINUE } public med(id) {         if(get_cvar_num("ns_medpack_enable")==1)     {             new item[33]             item = "item_health"                give_item(id,item)             return PLUGIN_HANDLED             }     else if(get_cvar_num("ns_medpack_enable")==0)         client_print(id,print_console,"[NS Give medpack]This plugin is disable. Set ns_medpack_enable to 1 to re-enable.")     return PLUGIN_CONTINUE }

it drops the meds but not the ammo.
questions
1: why dosent the ammo work when its identical to the med?
2: how would i get the current res amount for the marine team, then change it to a new value?

i tried ns_give_item in place of five item and in game nothing happens for either meds or ammo. there is no errors in either case.

also if there is already one that does something like this let me know, may not need to build my own.

Thanks
Rorthic is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 05-01-2005 , 12:13  
Reply With Quote #2

1. No idea why the ammo doesn't work

2. Use ns_get_res and ns_set_res, check the funcwiki for more information

3. You can just use give_item(id,"item_*") instead of making a variable for it.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
DiscoBBQ
Veteran Member
Join Date: Jan 2005
Location: Clemson, South Carolina
Old 05-01-2005 , 19:20  
Reply With Quote #3

new item[33]

Could it be the 33? maybe try 256?
DiscoBBQ is offline
LynX
Veteran Member
Join Date: Oct 2004
Old 05-01-2005 , 19:37  
Reply With Quote #4

Maybe except array with 33 try
Code:
new item = "item_genericammo"
__________________
Current plugin : SoulPunisher anti-cheat
Percentage done : {||--------} 20%

If you think v3x is a PIMP, paste this into your sig!

If you think Bailopan is DA BOMB, paste this into your sig
LynX is offline
Send a message via ICQ to LynX
Rorthic
Junior Member
Join Date: Apr 2005
Old 05-01-2005 , 20:27  
Reply With Quote #5

Code:
new item = "item_genericammo"
gives compile error error 033:array must be indexed and error 035:argument type mismatch

so i did
Code:
new item[33] = "item_genericammo"
Code:
new item[256] = "item_genericammo"
compiled fine but still getting no ammo

tried
Code:
give_item(id,"item_genericammo")
same thing no ammo

I found another plugin called admin_weapons_ns and in the sma file he used give_item(id,"item_genericammo") too but his plugin dosent drop ammo either.

also for the res i tried
Code:
new float:a = float(ns_get_res(id)) //res currently have a -=15.0    //take 15 away from res for getting medpack ns_set_res(id, a)   //set new res amount
it does nothing to the marine team res but some screwy things to the alien res. the doc on the ns_set_res says it only works for the alien team. any other idea on how to take the res away. Or spawn a med and ammo like the commander dropped them? but without him dropping them.

Just had a thought, does the fun.inc know what item_genericammo is, for cs each ammo has a different name, think this could be the ammo problem?
Rorthic is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 05-01-2005 , 21:40  
Reply With Quote #6

A) Pinkfairie: WTF, that has nothing whatsoever in the most related @#$% to do with it, you probably don't even know what the number is for, do you?

B) LynX: You can't assign an integer a string value.

C) Rorthic: The Fun module doesn't have to "know" about item_genericammo to give it to a player. Perhaps item_genericammo is an old an unsupported entity within NS?
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Rorthic
Junior Member
Join Date: Apr 2005
Old 05-01-2005 , 22:58  
Reply With Quote #7

if you type give item_genericammo into the console it gives you ammo. Also with logging on when you drop ammo it says item_genericammo.
Rorthic is offline
Rorthic
Junior Member
Join Date: Apr 2005
Old 05-03-2005 , 19:41  
Reply With Quote #8

ok so i got the ammo to work now, it was a simple change, im guessing when i tried it originally i compiled the wrong file, anyways this works for the ammo,
Code:
ns_give_item(id,"item_genericammo")

now all i need to know if how to change the marine team res. I dont want them to be free.
Rorthic is offline
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 16:21.


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