AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   infinite ammo (https://forums.alliedmods.net/showthread.php?t=82428)

card 12-23-2008 04:39

infinite ammo
 
hi, i need a code for infinite ammo, but ammo to be freezed (infinite ammo, eg. at usp, to show allways 12/24, never 11/24 or something like that).
i think weapon should be verified in weapon_event, than i have to put ammo +1, but i don`t know how.
yes i used search, but there is no such a plugin with these options .. :(

CodeMaster 12-24-2008 07:35

Re: infinite ammo
 
Here it is:
Code:

#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <fakemeta_util>

#define PLUGIN "Infinite Ammo"
#define VERSION "1.0"
#define AUTHOR "CodeMaster"

new max_ammo[30] = {13,0,10,0,7,0,30,30,0,30,20,25,30,35,25,12,20,10,30,100,8,30,30,20,0,7,30,30,0,50}

public plugin_init() {
    register_plugin(PLUGIN, VERSION, AUTHOR)
   
    register_forward(FM_PlayerPreThink,"hook_prethink")
}

public hook_prethink(id) {
    if(is_user_alive(id)) {
        new weapon_id = get_user_weapon(id)
        if(weapon_id != CSW_C4 && weapon_id != CSW_KNIFE && weapon_id != CSW_HEGRENADE && weapon_id != CSW_FLASHBANG && weapon_id != CSW_SMOKEGRENADE) {   
            new weapon = fm_get_user_weapon_entity(id)
            cs_set_weapon_ammo(weapon,max_ammo[weapon_id - 1])
        }
    }
    return FMRES_HANDLED
}

I've did it from my own curiosity about how would it work, but it took me some time. Its tested and it works fine. If you are curios how does it work feel free to ask.
BTW: It needs fakemeta_util by VEN. You can find it here http://forums.alliedmods.net/showthread.php?t=28284

+karma if you respect my time ;)

Cheers ;)

Nidza

Arkshine 12-24-2008 08:07

Re: infinite ammo
 
Here a better way : http://forums.alliedmods.net/showthr...182#post725182

@ CodeMaster : Don't attach .amxx but .sma.

CodeMaster 12-24-2008 08:56

Re: infinite ammo
 
Ok, I'm sorry, but I've already pasted the code, so I thought I should attach amxx...
And I'm sorry again, but that was the way I did it, I'm not so experienced.
If anyone could explain me pdata that could be more than useful.

Thanks

Nidza

ConnorMcLeod 12-24-2008 09:28

Re: infinite ammo
 
1 Attachment(s)
This should work as you want :

card 12-24-2008 10:01

Re: infinite ammo
 
thank you codemaster, works perfect !!! GJ ! + karma ofc

CodeMaster 12-24-2008 12:26

Re: infinite ammo
 
I'm glad I could help someone :)

YamiKaitou 12-24-2008 15:52

Re: infinite ammo
 
@CodeMaster: AMXX file removed. Do not post them

CodeMaster 12-24-2008 16:01

Re: infinite ammo
 
Ok, sorry I'm new here, I thought it may be useful as someone doesn't script or doesn't have fakemeta_util.inc

Nidza

danielkza 12-24-2008 16:57

Re: infinite ammo
 
Quote:

Originally Posted by CodeMaster (Post 732660)
Ok, sorry I'm new here, I thought it may be useful as someone doesn't script or doesn't have fakemeta_util.inc

Nidza

fakemeta_util is blunded with the default AMXX installation in versions 1.8 and onwards. And whenever you attach the SMA the forums generate a link to the compiled version automatically.


All times are GMT -4. The time now is 09:15.

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