Raised This Month: $51 Target: $400
 12% 

[HELP] Infinite ammo?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 05-31-2018 , 14:08   [HELP] Infinite ammo?
Reply With Quote #1

I need help for infinite ammo. I want to make a module for R1ko VIP sistem
Code:
public void OnPluginStart()
{
	HookEvent("weapon_fire", ClientWeaponReload);
}

public Action ClientWeaponReload(Handle event, const char[] name, bool bIsVIP)
{
	int iClient = GetClientOfUserId(GetEventInt(event, "userid"));
	
	int weapon = GetEntPropEnt(iClient, Prop_Data, "m_hActiveWeapon");
	char classname[32];
	GetEdictClassname(weapon, classname, sizeof(classname));

	if(IsPlayerAlive(iClient) && bIsVIP &&  VIP_IsClientFeatureUse(iClient, BULLETS))
	{
		if(weapon > 0 && (weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_PRIMARY) || weapon == GetPlayerWeaponSlot(iClient, CS_SLOT_SECONDARY)))
		{
			if (StrContains(classname, "weapon_", false))
			{
				SetEntProp(weapon, Prop_Send, "m_iClip1", 32);
				SetEntProp(weapon, Prop_Send, "m_iClip2", 32);	
			}
		}
	}
}
This What I tryed, but I failed, can anyone help me, please?

Code:
	int weapon = GetEntPropEnt(iClient, Prop_Data, "m_hActiveWeapon");
Is this right?

Code:
if (StrContains(classname, "weapon_", false))
Here I tryed to give infinite ammo just for weapons, without bugs like infinte nades, defuses, c4s etc

Last edited by kratoss1812; 05-31-2018 at 14:10.
kratoss1812 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 05-31-2018 , 14:20   Re: [HELP] Infinite ammo?
Reply With Quote #2

Not sure if it'll help but you may want to make sure that the StrContains doesn't return -1.

Code:
if (StrContains(classname, "weapon_", false) != -1)
__________________
Psyk0tik is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 05-31-2018 , 14:47   Re: [HELP] Infinite ammo?
Reply With Quote #3

Quote:
Originally Posted by Crasher_3637 View Post
Not sure if it'll help but you may want to make sure that the StrContains doesn't return -1.

Code:
if (StrContains(classname, "weapon_", false) != -1)
it was not that
kratoss1812 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-31-2018 , 14:53   Re: [HELP] Infinite ammo?
Reply With Quote #4

Weapon fire is unreliable for this. What u want to do is use a repeating timer or ongameframe. Check the clip and the reserve ammo. When clip reaches 1 and reserve reaches 0 reload the reserve and or clip as well. What game is this for?

Last edited by MasterMind420; 05-31-2018 at 14:58.
MasterMind420 is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 05-31-2018 , 14:56   Re: [HELP] Infinite ammo?
Reply With Quote #5

Quote:
Originally Posted by MasterMind420 View Post
Weapon fire is unreliable for this. What u want to do is use a repeating timer or ongameframe. Check the clip and the reserve ammo. When clip reaches 1 and reserve reaches 0 reload the reserve and or clip as well.
so.. I should do this?
Code:
public void OnGameFrame()
{
	CreateTimer(1.0, Bullets);
}
or
Code:
public void OnGameFrame()
{
	code
}

Last edited by kratoss1812; 05-31-2018 at 14:57.
kratoss1812 is offline
MasterMind420
BANNED
Join Date: Nov 2010
Old 05-31-2018 , 15:03   Re: [HELP] Infinite ammo?
Reply With Quote #6

Quote:
Originally Posted by kratoss1812 View Post
so.. I should do this?
Code:
public void OnGameFrame()
{
	CreateTimer(1.0, Bullets);
}
or
Code:
public void OnGameFrame()
{
	code
}
Use just ongameframe...if it doesnt work with your code i'll see about modifying it. But there could be several problems with your code...especially making sure the vip bools are working correctly. Printtochat in a few parts of your code just to see how far it gets before it breaks, if thats the case
MasterMind420 is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 05-31-2018 , 15:21   Re: [HELP] Infinite ammo?
Reply With Quote #7

Quote:
Originally Posted by MasterMind420 View Post
Use just ongameframe...if it doesnt work with your code i'll see about modifying it. But there could be several problems with your code...especially making sure the vip bools are working correctly. Printtochat in a few parts of your code just to see how far it gets before it breaks, if thats the case
I will try, thank you
kratoss1812 is offline
Santi.
Member
Join Date: Oct 2010
Location: Cordoba(Argentina)
Old 06-11-2018 , 23:26   Re: [HELP] Infinite ammo?
Reply With Quote #8

Idk the game you're working for but CS:GO has the event "EventWeaponFire".. So you can hook it, get the weapon he's firing and give to it clip+1 or +3 if the weapon is on burst mode.

Events here: https://wiki.alliedmods.net/Counter-...fensive_Events.
Santi. is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Old 06-12-2018 , 05:33   Re: [HELP] Infinite ammo?
Reply With Quote #9

Why not FakeClientCommand(iClient, "sv_infinite_ammo 1"); I don't see why you shouldn't use it.
mug1wara is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 06-12-2018 , 06:04   Re: [HELP] Infinite ammo?
Reply With Quote #10

Quote:
Originally Posted by mug1wara View Post
Why not FakeClientCommand(iClient, "sv_infinite_ammo 1"); I don't see why you shouldn't use it.
Is it possible to send console commands with FakeClientCommand and also cheats flagged cmds without sv_cheats 1? also that is a server replied cvar not client.
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!

Last edited by Papero; 06-12-2018 at 06:05.
Papero 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 05:55.


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