AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Unlimited ammo plugins , but not nades (https://forums.alliedmods.net/showthread.php?t=28886)

cccpsmiley 05-25-2006 05:13

Unlimited ammo plugins , but not nades
 
1 Attachment(s)
i run a dod server and i wanted this but with no unlimited nades.

would it work if i took out
Code:

dod_set_user_ammo ( player,DODW_HANDGRENADE,251)
                dod_set_user_ammo ( player,DODW_STICKGRENADE,251)
                dod_set_user_ammo ( player,DODW_STICKGRENADE_EX,251)
                dod_set_user_ammo ( player,DODW_HANDGRENADE_EX,251)
        }

this is what it actually looks like :

Code:

public refresh_ammo_dod()
{
        new Players[32]
        new playerCount, i, player
        get_players(Players, playerCount, "a")
        for (i=0; i<playerCount; i++)
        {
                player = Players[i]
                if(AmmoMaster[player])
                {
                new l_weapon, l_dud
                l_weapon = dod_get_user_weapon(player,l_dud,l_dud)
                if(l_weapon > 2)
                        dod_set_user_ammo ( player,l_weapon,251)
                }
                dod_set_user_ammo ( player,DODW_HANDGRENADE,251)
                dod_set_user_ammo ( player,DODW_STICKGRENADE,251)
                dod_set_user_ammo ( player,DODW_STICKGRENADE_EX,251)
                dod_set_user_ammo ( player,DODW_HANDGRENADE_EX,251)
        }


Hawk552 05-25-2006 08:25

Why don't you try it first and then ask if it doesn't work?

cccpsmiley 05-25-2006 11:29

no it doesnt compile

Hawk552 05-25-2006 17:18

What? I removed the 4 lines you were talking about, and it compiles fine now:

Code:
/* Unlimited ammo in dod/tfc/ns/ts/esf/sven [ns] (ns module required) all ammo except mines + hand nades, infinite jetpack + energy on ns_ maps a player with a shotgun will leave an ammo trail, which will take maybe 20(?) sec to disolve [tfc] (tfcx module required) should work for all weapons (nades included), except the detpack [dod] (dodfun and dodx module required) should work for all weapons (nades included) display of actual ammo in backpack gets updated on reload [ts] (engine, tsx, and tsfun modules required) no reloading required all weapons except nades and knifes [sven] (fun module required) all types of ammo except: handgrenade,tripmine,snark,satchel (these have proved to be very buggy and are on my todo list) you should stop seeing/hearing tons of ammo clips once you max out (~20 seconds) i'll use the svencoop module when it's officially maintained+compiled by the amxmodx team [esf] (engine module required) infinite ki [cs] <a href="http://forums.alliedmods.net/showthread.php?p=7796" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?p=7796</a> [all] yes, an every 0.5-2 second task is very dirty, but in the long term i have not noticed a hit in preformace or any crashes caused by this credits: Twilight Suzuka for recently updating the ts modules and giving me a beta version. faluco for recently updating the tfcx modules and giving me a beta version. used godmode template from admin_allinone maintianed by BigBaller, * -) ADMIN GODEMODE v0.9.3 by f117bomb. template from AssKicR's ammo plugin. Suicid3 for the module filter help + code. remove ent + find ent stuff from EKS Dump Ent Info <a href="http://forums.alliedmods.net/showthread.php?t=4533" target="_blank" rel="nofollow noopener">http://forums.alliedmods.net/showthread.php?t=4533</a> . set ki method from:{[ Corona-Bytes.NET ] EvolutionX Core Plugin (c) Corona - Bytes .NET coders :: <a href="mailto:[email protected]">[email protected]</a> > 2005 Corona Bytes :: http://www.corona-bytes.net}. todo: more ammo types (the ones that stack weapon_'s), better method, only ammo for weapon in hand, support for as many mods as possible, get rid of the need to reload weapons, change ns-shotgun code after the next amxmodx release */ #include <amxmodx.inc> #include <amxmisc.inc> //just because the includes here doesn't mean the related modules are required #include <fun.inc> #include <engine.inc> #include <tsfun.inc> #include <tsx.inc> #include <ns.inc> #include <dodfun.inc> //#include <tfcx.inc> //tfcx mini, to get rid of the dupe native errors #include <tfcconst> #pragma library tfcx native  tfc_setbammo(index, ammo, value); //#include <dodx.inc> //dodx mini, to get rid of the dupe native errors #include <dodconst> #pragma library dodx native dod_get_user_weapon(index,&clip,&ammo); // VARIABLES new bool:AmmoMaster[33] new g_MaxEnts new g_modName[15] new g_supported_mod = false //---------------------------------------------------------------------------------------------- public plugin_init() {     register_plugin("uAmmo","1.0.1","Seather")         if(is_module_loaded("engine") != -1)         g_MaxEnts = get_global_int(GL_maxEntities)     get_modname(g_modName,14)             g_supported_mod = true     if(equal(g_modName,"ts"))         set_task( 0.5, "refresh_ammo_ts" ,_,_,_, "b" )     else if(equal(g_modName,"dod"))         set_task( 2.0, "refresh_ammo_dod",_,_,_, "b" )     else if(equal(g_modName,"esf"))         set_task( 2.0, "refresh_ammo_esf",_,_,_, "b" )     else if(equal(g_modName,"ns"))         set_task( 2.0, "refresh_ammo_ns",_,_,_, "b" )     else if(equal(g_modName,"SvenCoop"))         set_task( 2.0, "refresh_ammo_sven",_,_,_, "b" )     else if(equal(g_modName,"tfc"))         set_task( 2.0, "refresh_ammo_tfc",_,_,_, "b" )     else     {         g_supported_mod = false         log_amx("Mod %s is not supported by this plugin",g_modName)     }     if(g_supported_mod)         register_concmd("amx_ammo","admin_ammo",ADMIN_LEVEL_A,"<authid, nick, @team or #userid> <0=OFF 1=ON>") } //---------------------------------------------------------------------------------------------- public plugin_natives() {     set_module_filter("module_filter");     set_native_filter("native_filter"); } public module_filter(const module[]) {     get_modname(g_modName,14)     if(equali(module,"fun") && !equal(g_modName,"SvenCoop"))     {         //log_amx("fun module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"engine") && !equal(g_modName,"ts") && !equal(g_modName,"esf"))     {         //log_amx("engine module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"tsfun") && !equal(g_modName,"ts"))     {         //log_amx("tsfun module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"tsx") && !equal(g_modName,"ts"))     {         //log_amx("tsx module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"ns") && !equal(g_modName,"ns"))     {         //log_amx("ns module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"dodfun") && !equal(g_modName,"dod"))     {         //log_amx("dodfun module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"dodx") && !equal(g_modName,"dod"))     {         //log_amx("dodx module was not enabled." );         return PLUGIN_HANDLED     }     if(equali(module,"tfcx") && !equal(g_modName,"tfc"))     {         //log_amx("tfcx module was not enabled." );         return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE //Abort Plugin! } public native_filter(const name[], index, trap) {     if (!trap)         return PLUGIN_HANDLED     return PLUGIN_CONTINUE } //---------------------------------------------------------------------------------------------- public refresh_ammo_ts() {     new Players[32]     new playerCount, i, player     new l_clip,l_ammo,l_mode,l_extra,l_weapon     new l_weapon_name[32]     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {             l_weapon = ts_getuserwpn ( player, l_clip, l_ammo, l_mode, l_extra )             //client_print(0, print_chat, "blah: l_weapon %d l_clip, %d l_ammo, %d l_mode, %d l_extra %d", l_weapon, l_clip,l_ammo,l_mode,l_extra)             if(l_clip < 1 && l_weapon > 0 && l_weapon != TSW_TKNIFE && l_weapon != TSW_KUNG_FU && l_weapon != TSW_CKNIFE && l_weapon != TSW_SKNIFE && l_weapon != TSW_M61GRENADE && l_weapon != TSW_KATANA && l_weapon != TSW_C4)             {             get_weaponname(l_weapon,l_weapon_name,31)             engclient_cmd(player,"drop",l_weapon_name)             if(l_weapon == TSW_AMK23) //akimbo handling (single and dual type)                 ts_giveweapon ( player, TSW_MK23, 222, l_extra )             if(l_weapon == TSW_A57) //akimbo handling (single and dual type)                 ts_giveweapon ( player, TSW_57, 222, l_extra )             if(l_weapon == TSW_AUZI) //akimbo handling (single and dual type)                 ts_giveweapon ( player, TSW_UZI, 222, l_extra )             ts_giveweapon ( player, l_weapon, 222, l_extra )             //client_print(0, print_chat, "blah2: %s", l_weapon_name)                         //lets clean up the weapon we drop             new ClassName[32]             new Float:Dist             new Float:nearDist             new nearEnt             new temp_sep_weaps = 1             if(l_weapon == TSW_AMK23 || l_weapon == TSW_A57 || l_weapon == TSW_AUZI) //need to delete two weapons for akimbos (single and dual type)                 temp_sep_weaps = 2             while(temp_sep_weaps > 0)             {                 nearDist = 400.0                 nearEnt = -1                 for(new i=1;i<=g_MaxEnts;i++)  if(is_valid_ent(i))                 {                     entity_get_string(i,EV_SZ_classname,ClassName,31)                     if(containi(ClassName,"WorldGun") != -1)                     {                         Dist = entity_range(player,i)                         if(Dist < nearDist)                         {                         nearDist = Dist                         nearEnt = i                         }                     }                 }                 if(nearEnt != -1)                     remove_entity(nearEnt)                 temp_sep_weaps--             }             }         }     } } //---------------------------------------------------------------------------------------------- public refresh_ammo_dod() {     new Players[32]     new playerCount, i, player     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {         new l_weapon, l_dud         l_weapon = dod_get_user_weapon(player,l_dud,l_dud)         if(l_weapon > 2)             dod_set_user_ammo ( player,l_weapon,251)         }     } } //---------------------------------------------------------------------------------------------- public refresh_ammo_esf() {     new Players[32]     new playerCount, i, player     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {         //set ki         entity_set_float( player, EV_FL_fuser4, 1000.0 );         }     } } //---------------------------------------------------------------------------------------------- public refresh_ammo_ns() {     new Players[32]     new playerCount, i, player     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {             if(ns_has_weapon(player,WEAPON_SHOTGUN))             {             ns_give_item(player,"item_genericammo") //yay for generic ammo, hmm.. on ns_ maps a trail of ammo is created, though it will get auto cleaned after a while             }             else             {             ns_set_weap_reserve ( player, WEAPON_PISTOL, 30 )             //ns_set_weap_reserve ( player, WEAPON_SHOTGUN, 20 ) // 1m/15d/2006, up to date, set shotgun ammo doesn't work             ns_set_weap_reserve ( player, WEAPON_HMG, 250 )             //ns_set_weap_reserve ( player, WEAPON_MINE, 4 ) //mines don't work             ns_set_weap_reserve ( player, WEAPON_GRENADE_GUN, 250 )             ns_set_weap_reserve ( player, WEAPON_LMG, 250 )             }             ns_set_jpfuel ( player, 100.0 )             ns_set_energy ( player, 100.0 )                     }     } } //---------------------------------------------------------------------------------------------- public refresh_ammo_sven() {     new Players[32]     new playerCount, i, player     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {         give_item(player,"ammo_glockclip")         give_item(player,"ammo_buckshot")         give_item(player,"ammo_mp5clip")         give_item(player,"ammo_ARgrenades")         give_item(player,"ammo_357")         give_item(player,"ammo_762")         give_item(player,"ammo_556")         give_item(player,"ammo_crossbow")         give_item(player,"ammo_gaussclip")         give_item(player,"ammo_rpgclip")         }         /* //1. i'm too lazy to get the numbers, 2. even if i knew the numbers this would be buggy, spawn too many ents and crash, i might be able edit the spawnflags and hope that the ent will get auto destroyed... then again i could prob destroy it.. so its back to me being lazy, to the todo list it goes         new Weapons[32]         new numWeapons, i, weapon         get_user_weapons(player, Weapons, numWeapons)         for (i=0; i<numWeapons; i++)         {         weapon = Weapons[i]         if(weapon == ?)             give_item(player,"weapon_handgrenade")         else if(weapon == ?)             give_item(player,"weapon_tripmine")         else if(weapon == ?)             give_item(player,"weapon_satchel")         }//don't forget snark         */     } } //---------------------------------------------------------------------------------------------- public refresh_ammo_tfc() {     new Players[32]     new playerCount, i, player     get_players(Players, playerCount, "a")     for (i=0; i<playerCount; i++)     {         player = Players[i]         if(AmmoMaster[player])         {         tfc_setbammo(player,TFC_AMMO_SHELLS,70)         tfc_setbammo(player,TFC_AMMO_BULLETS,70)         tfc_setbammo(player,TFC_AMMO_CELLS,200)         tfc_setbammo(player,TFC_AMMO_ROCKETS,50)         tfc_setbammo(player,TFC_AMMO_NADE1,4)         tfc_setbammo(player,TFC_AMMO_NADE2,4)         }     } } //---------------------------------------------------------------------------------------------- public client_connect(id) {    AmmoMaster[id] = false } public client_disconnect(id) {    AmmoMaster[id] = false } //---------------------------------------------------------------------------------------------- public admin_ammo(id,level,cid) {     if (!cmd_access(id,level,cid,3))         return PLUGIN_HANDLED     new arg[32], arg2[8], name2[32]     read_argv(1,arg,31)     read_argv(2,arg2,7)     get_user_name(id,name2,31)     if(str_to_num(arg2) != 0 && str_to_num(arg2) != 1) return PLUGIN_HANDLED         if (arg[0]=='@'){         new players[32], inum         get_players(players,inum,"ae",arg[1])         if (inum==0){             console_print(id, "no match")             return PLUGIN_HANDLED         }         for(new a=0;a<inum;++a) {             //magic!             if(str_to_num(arg2) == 0)                 AmmoMaster[players[a]] = false             else                 AmmoMaster[players[a]] = true         }         switch(get_cvar_num("amx_show_activity"))   {             case 2: client_print(0,print_chat, "ADMIN %s: set unlimited ammo on %s", name2, arg[1])             case 1: client_print(0,print_chat, "ADMIN: set unlimited ammo on %s", arg[1])             }         console_print(id, "unlimited ammo set")         //log_amx("%L", LANG_SERVER, "AINO_LOG_GODMODE_ALL", name2, arg[1])     }     else {         new player = cmd_target(id,arg,3)         if (!player) return PLUGIN_HANDLED                 //magic!         if(str_to_num(arg2) == 0)                 AmmoMaster[player] = false             else                 AmmoMaster[player] = true             new name[32]         get_user_name(player,name,31)         switch(get_cvar_num("amx_show_activity"))   {             case 2: client_print(0, print_chat, "ADMIN %s: set unlimited ammo on %s", name2, name)             case 1: client_print(0, print_chat, "ADMIN: set unlimited ammo on %s", name)             }         console_print(id, "Client ^"%s^" has unlimited ammo set", name)     }     return PLUGIN_HANDLED } //----------------------------------------------------------------------------------------------

cccpsmiley 05-25-2006 18:25

yea sorry im an idiot the version u gave me compiled perfectly thanks.
i was wondering if it is possible to ave this plugin as a server setting, where it'll be unlimited ammo for all guns at all times, instead of giving it to ppl.

Hawk552 05-25-2006 18:31

Quote:

Originally Posted by cccpsmiley
yea sorry im an idiot the version u gave me compiled perfectly thanks.
i was wondering if it is possible to ave this plugin as a server setting, where it'll be unlimited ammo for all guns at all times, instead of giving it to ppl.

There are better unlimited ammo plugins out there that'll do that. Namely UAIO.

cccpsmiley 05-25-2006 18:44

i run a day of defeat server : #include <cstrike>

not gonna work


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

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