Raised This Month: $ Target: $400
 0% 

infinite ammo


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
card
Member
Join Date: Jun 2008
Old 12-23-2008 , 04:39   infinite ammo
Reply With Quote #1

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 ..

Last edited by card; 12-23-2008 at 04:50.
card is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 07:35   Re: infinite ammo
Reply With Quote #2

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
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation


Last edited by YamiKaitou; 12-24-2008 at 15:48.
CodeMaster is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 12-24-2008 , 08:07   Re: infinite ammo
Reply With Quote #3

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

@ CodeMaster : Don't attach .amxx but .sma.
Arkshine is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 08:56   Re: infinite ammo
Reply With Quote #4

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
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 12-24-2008 , 09:28   Re: infinite ammo
Reply With Quote #5

This should work as you want :
Attached Files
File Type: sma Get Plugin or Get Source (infinite_ammo.sma - 895 views - 2.5 KB)
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
card
Member
Join Date: Jun 2008
Old 12-24-2008 , 10:01   Re: infinite ammo
Reply With Quote #6

thank you codemaster, works perfect !!! GJ ! + karma ofc
card is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 12:26   Re: infinite ammo
Reply With Quote #7

I'm glad I could help someone
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-24-2008 , 15:52   Re: infinite ammo
Reply With Quote #8

@CodeMaster: AMXX file removed. Do not post them
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
CodeMaster
Junior Member
Join Date: Dec 2008
Old 12-24-2008 , 16:01   Re: infinite ammo
Reply With Quote #9

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
__________________
+karma me if you found me useful
[60% -- ||||||||||] Learning AMXModX functions for better adaption to AMXModX Pawn
[100% - ||||||||||] Pawn Readaptation

CodeMaster is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 12-24-2008 , 16:57   Re: infinite ammo
Reply With Quote #10

Quote:
Originally Posted by CodeMaster View Post
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.
__________________

Community / No support through PM
danielkza 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 09:15.


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