AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   NS health and ammo drop (https://forums.alliedmods.net/showthread.php?t=12999)

Rorthic 04-30-2005 23:35

NS health and ammo drop
 
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

XxAvalanchexX 05-01-2005 12:13

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.

DiscoBBQ 05-01-2005 19:20

new item[33]

Could it be the 33? maybe try 256?

LynX 05-01-2005 19:37

Maybe except array with 33 try
Code:
new item = "item_genericammo"

Rorthic 05-01-2005 20:27

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?

XxAvalanchexX 05-01-2005 21:40

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?

Rorthic 05-01-2005 22:58

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 05-03-2005 19:41

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.


All times are GMT -4. The time now is 16:50.

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