ClipInfo - Infinite ammo - XxAvalanchexX saved the day
(For The Specialists)
I tried logging ClipInfo (Message 101) with the message logger and it didn't log anything. So, I went to my own methods, and did this: Code:
I imagine I can't do infinite ammo this way, or I am doing something wrong. Please point out any errors or give some suggestions as to what I can do to make a nice infinite ammo plugin. I really don't like the method implemented by Seather here, he just forces the client to drop the weapon and gives the client the same weapon again, so it's not fluid at all and it requires running a relatively lengthy function every 0.5 seconds. ClipInfo is the only event that I found that changes when the ammo goes down. WeaponInfo is called on reload, though. |
Re: ClipInfo - Infinite ammo - I think it can't be done...
You don't need to send the id as a byte, it's included as the message header. Only send the ammo amount. But all this will do is update the client's HUD, it won't actually change their amount of ammo.
|
Re: ClipInfo - Infinite ammo - I think it can't be done...
:cry:
|
Re: ClipInfo - Infinite ammo - I think it can't be done...
PHP Code:
|
Re: ClipInfo - Infinite ammo - I think it can't be done...
Not for clip ammo. You need to use Mod Specific natives. Like for cs you would use cs_set_weapon_ammo and you have to find the Weapon Entity Index for the player you want to set the ammo too. Since ammo clip is on the Weapon Entity Index Private Data.
Here a small script I did for Counter-Strike though. Code:
|
Re: ClipInfo - Infinite ammo - I think it can't be done...
@teame06
Well, theres no native for TS for setting clip ammo, so I don't think your code really helps :| to make a plugin for TS. Also, correct me if I'm wrong, but I don't think CurWeapon is executed in TS. But it's nice to see how its done in CS. I don't understand some of the code. Code:
Whats up with that? @XxAvalanchexX I just changed the code to look like this: Code:
EDIT: I just realized the above code will read the value that the game sends and send the same message the game would normally send if the plugin didn't even exist. Doh. I changed the write_byte(clip) to write_byte(id) and it set my ammo to my id number, but I did not have unlimited ammo, just didn't know how many bullets I had left... so you're right XxAvalanchexX. How did you know about ClipInfo? I didn't find it in any documentation. |
Re: ClipInfo - Infinite ammo - I think it can't be done...
I'd still like some answers to the questions above:| , but I also have another question.
Can I use set_entity_edict or int, or some other method to change a weapon entity's clip ammo value? I don't think I can, but if theres some way to do that besides writing a module myself, I didn't find it. I might get desperate and learn write my own ts module to make ts_set_weapon_ammo() an actual native. Any good documentation I should read before I get started on that? |
Re: ClipInfo - Infinite ammo - I think it can't be done...
Let me clear this up a bit.
First of all you should understand that the message doesn't change the actual ammo value, it just updates the HUD or whatever on the client side. Second: you do not need to write a module, you just have to find where the value exactly is stored and then alter it with existing modules fakemeta/engine/memhack etc. The ammo value may be stored in the entity pdata, or even in the pev structure. I've heard from Greenberet that he wrote the pdata scanner, but i think he never released it, maybe he wanted to keep it private or still planning to release it later - don't know. The worst thing that can be, is that the ammo value is stored in the memory block that can't be accessed through standard methods, then the only way would be the memory hacking. |
Re: ClipInfo - Infinite ammo - I think it can't be done...
1 Attachment(s)
Let me know if these work for you. This is a clean up of my old modify weapon ammo function, and a brand new modify weapon clip function. The offset values are for Windows 32-bit servers. I don't know the offsets for 64-bit servers, and I'm not 100% sure that my +4 for Linux servers is accurate.
EDIT: file moved to http://forums.alliedmods.net/showthread.php?p=400113 |
Re: ClipInfo - Infinite ammo - I think it can't be done...
@VEN
I already knew that it changed only HUD, but thanks for the extra info :) XxAvalanchexX, I don't know where you got the information to make that... Just to clarify: Is ava_ts.inc called a module? or do you just call that an include file? Does a module necessarily use a .dll? But anyway, to the testing. (I run Windows 32-bit) The ts_set_weapon_clip does the same thing as sending a ClipInfo message with whatever integer you want for the clip. It doesn't actually modify the gun's clip, just the HUD display. The ts_set_weapon_ammo works beautifully, with no problem. :up: I call the function on WeaponInfo and the backpack ammo is set just fine. |
| All times are GMT -4. The time now is 04:50. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.