1 (edited by Shield 2011-08-07 14:57:49)

Topic: Infinite ammo

Hey, I need help on adding infinite ammo for my grenade.
Which file do I add it in and how?

EDIT: Fixed.. I went to src -> game -> server -> entities -> character.cpp
and changed

if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0) // -1 == unlimited
        m_aWeapons[m_ActiveWeapon].m_Ammo--;

into

if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0) // -1 == unlimited
        m_aWeapons[m_ActiveWeapon].m_Ammo;

2

Re: Infinite ammo

If you want to add this for a specific weapon, you have to check if the active-weapon is the grenade launcher and then just dont decrease the ammo-value on usage.
Other method would be to manipulate the ammo count on the pickup of the grenade launcher.

Btw: Its nice you explained the way you solved your problem, but the snippets are kinda useless big_smile

3 (edited by Shield 2011-08-07 16:51:38)

Re: Infinite ammo

Slayer *gV* wrote:

If you want to add this for a specific weapon, you have to check if the active-weapon is the grenade launcher and then just dont decrease the ammo-value on usage.
Other method would be to manipulate the ammo count on the pickup of the grenade launcher.

Btw: Its nice you explained the way you solved your problem, but the snippets are kinda useless big_smile

I know it Slayer wink but my mod is gonna be a Grenade Instagib with more features than Sushi Tee's one.

Features so far:

CHAT COMMANDS:

/gametype or /gt VALUE
eg. /gametype gtdm, gdm, gctf.
And it starts a vote.

/info <-- Most servers have it lol tongue
/help <-- Most servers have it too lol tongue
and ofc /cmdlist.

/infiniteammo or /ia VALUE
eg. /infiniteammo 0, 1.
This starts a vote which changes the infiniteammo into 5 shots only but if you kill someone you get refill. Also it regens ammo every 4-6 seconds.. Yes 4 seconds or 5 seconds or 6 seconds.

/admins
Will show the admins on the server

/adminsonline or /ao
Will show the admins online right now by IP not name.

4

Re: Infinite ammo

Botox made grenade instagib?

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

5

Re: Infinite ammo

Sushi Tee wrote:

Botox made grenade instagib?

Oh yes SORRY big_smile:D:D I made mistake.. I knew it was you.. But I just thought of some mods that BotoX made so I some how typed in his name -.-" Sorry big_smile Edited the post of mine big_smile

6

Re: Infinite ammo

Sushi Tee wrote:

Botox made grenade instagib?

I doubt it... he makes only good mods.

7

Re: Infinite ammo

Hip-Hop_Blond wrote:
Sushi Tee wrote:

Botox made grenade instagib?

I doubt it... he makes only good mods.

:3
Sorry but [N]City wasn't a good mod. (Ok 4 Servers allways full and over 30.000 Accounts, but it's City)
And I like Grenade Instagib big_smile You need more Skill then in Rifle Instagib ^^

8

Re: Infinite ammo

Shield: once again you shouldn't try to edit the source code without C++ knowledge, there is nothing good you can do out of it. Better to ask some coder or post here if you feel like having nice ideas for a mod.

This:

if(m_aWeapons[m_ActiveWeapon].m_Ammo > 0) // -1 == unlimited
        m_aWeapons[m_ActiveWeapon].m_Ammo;

Is completely useless, does absolutely nothing.

Not Luck, Just Magic.

9 (edited by Shield 2011-08-07 20:26:39)

Re: Infinite ammo

It is not Dune. It stops the code from removing ammos everytime you shoot = Infinite ammo.
You could also just delete the code or put /* AROUND IT */

And Dune. Who ever said that I got no C++ knowledge?
In the matter of fact I DO. Just because you haven't seen me around here before. Doesn't mean that I dont got any C++ knowledge. I've coded serveral games/servers. I just dont know the teeworlds files yet.. Where to find what etc..

10

Re: Infinite ammo

Hip-Hop_Blond wrote:
Sushi Tee wrote:

Botox made grenade instagib?

I doubt it... he makes only good mods.

thx hmm

uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

11

Re: Infinite ammo

Shield wrote:

It is not Dune. It stops the code from removing ammos everytime you shoot = Infinite ammo.
You could also just delete the code or put /* AROUND IT */

And Dune. Who ever said that I got no C++ knowledge?
In the matter of fact I DO. Just because you haven't seen me around here before. Doesn't mean that I dont got any C++ knowledge. I've coded serveral games/servers. I just dont know the teeworlds files yet.. Where to find what etc..

Letting these lines as is, not removing them is what made me think you didn't know very much what you were doing.

Not Luck, Just Magic.

12

Re: Infinite ammo

Shield: why did u ignore the comment which is on that one line...

// -1 == unlimited
uptee - a simple web interface for hosting and maintaining teeworlds servers
teerace - a website gathering results of trusted Race-mod servers providing global ranking and statistics
*gV* rox ^^

13

Re: Infinite ammo

Sushi Tee wrote:

Shield: why did u ignore the comment which is on that one line...

// -1 == unlimited

That was the first thing I thought when I read Shield's code.
The second thing was: "wtf, why does he put code that does nothing"