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

[THC RPG CS:GO] Total HardCore RPG


Post New Thread Reply   
 
Thread Tools Display Modes
JZServices
Member
Join Date: Jul 2013
Old 02-15-2014 , 05:26   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #31

Ok, here is a version with the previous two fixes and a possible regen ammo fix. I haven't had time testing it yet.

Modified on regen_ammo.inc regen_ammo_WeaponFire and Timer_OnRegen_ammoInterval

Code:
public regen_ammo_WeaponFire(client, const String:weapon[])
{
    if(IsValidPlayer(client))
        if(GetClientTeam(client)!=g_regen_ammoUpgradeConfigCache[UpgradeConfig_TeamLock])
        {
            if(GetPlayerUpgradeLevel(client,g_moduleregen_ammo)&&!g_bPlayerIsRegeneratingAmmo[client])
            {
		//originial code
		//static ammoCounts[] = { 0, 35, 90, 90, 200, 30, 120, 32, 100, 52, 100, 1, 1, 1, 1, 1 };
		
		static ammoCounts[] = { 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 0, 0, 0, 0, 0, 0 };
			
		//ADDED THIS IN TO CREATE MAX AMMO COUNT BASED UPON AMMO TYPE VERY SIMPLE AND SHOULD ACTUALLY BE USED IN CSS VERSION INSTEAD OF CPU INTENSIVE CHECKS
		//NO TIME ATM TO MAKE MAX AMMO AMOUNTS POSSIBLY CREATE A CONFIG FILE FOR THIS IN THE FUTURE TOO
		
		
		//1 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_50AE", 2, 1, 0, 0, "ammo_50AE_max", "ammo_50AE_impulse", 0, 10, 14);
		//2 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_762MM", 2, 1, 0, 0, "ammo_762mm_max", "ammo_762mm_impulse", 0, 10, 14);
		//3 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM", 2, 1, 0, 0, "ammo_556mm_max", "ammo_556mm_impulse", 0, 10, 14);
		//4 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM_SMALL", 2, 1, 0, 0, "ammo_556mm_small_max", "ammo_556mm_impulse", 0, 10, 14);
		//5 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM_BOX", 2, 1, 0, 0, &unk_CCACEF, "ammo_556mm_box_impulse", 0, 10, 14);
		//6 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_338MAG", 2, 1, 0, 0, "ammo_338mag_max", "ammo_338mag_impulse", 0, 12, 16);
		//7 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_9MM", 2, 1, 0, 0, "ammo_9mm_max", "ammo_9mm_impulse", 0, 5, 10);
		//8 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_BUCKSHOT", 2, 1, 0, 0, "ammo_buckshot_max", "ammo_buckshot_impulse", 0, 3, 6);
		//9 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_45ACP", 2, 1, 0, 0, "ammo_45acp_max", "ammo_45acp_impulse", 0, 6, 10);
		//10 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_357SIG", 2, 1, 0, 0, "ammo_357sig_max", "ammo_357sig_impulse", 0, 4, 8);
		//11 CAmmoDef::AddAmmoType(ammoDef, &unk_CCAE47, 2, 1, 0, 0, "ammo_357sig_small_max", "ammo_357sig_impulse", 0, 4, 8);
		//12 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_57MM", 2, 1, 0, 0, "ammo_57mm_max", "ammo_57mm_impulse", 0, 4, 8);
		//13 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_HEGRENADE", 64, 1, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
		//14 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_FLASHBANG", 0, 1, 0, 0, "ammo_grenade_limit_flashbang", 0, 0, 0, 8);
		//15 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_SMOKEGRENADE", 0, 1, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
		//16 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_MOLOTOV", 8, 0, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
		//17 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_DECOY", 0, 0, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
		//18 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_TASERCHARGE", 256, 3, 0, 0, 0, 0, 0, 0, 8);
		new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
		if (activeWeapon != -1)
		{
			new primary = GetPlayerWeaponSlot(client, _:SlotPrimary);
			new secondary = GetPlayerWeaponSlot(client, _:SlotSecondary);
			    
			if ((activeWeapon == primary) || (activeWeapon == secondary))
			{    
				new ammoType = GetEntData(activeWeapon, g_iAmmoTypeOffset);
				new max_ammo=ammoCounts[ammoType];
				if (ammoType != -1){g_bPlayerIsRegeneratingAmmo[client]=true;new Handle:datapack=CreateDataPack();WritePackCell(datapack, client);WritePackCell(datapack, max_ammo);WritePackCell(datapack, ammoType);WritePackCell(datapack, activeWeapon);CreateTimer(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Interval],Timer_OnRegen_ammoInterval,datapack,TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);}
			}
		}
            }
        }
}

public Action:Timer_OnRegen_ammoInterval(Handle:timer,Handle:datapack)
{
    ResetPack(datapack);
    new client=ReadPackCell(datapack);
    new max_ammo=ReadPackCell(datapack);
    new ammoType=ReadPackCell(datapack);
    new oldactiveWeapon=ReadPackCell(datapack);

    if(IsClientInGame(client)&&g_bPlayerIsRegeneratingAmmo[client])
    {
    	new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
    	if (activeWeapon==oldactiveWeapon)
    	{
		new amount=GetEntData(client,g_iAmmoOffset+(ammoType*4),4)+RoundToNearest(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Amount]*GetPlayerUpgradeLevel(client,g_moduleregen_ammo));
		if(amount>max_ammo)
		{
		    g_bPlayerIsRegeneratingAmmo[client]=false;
		    amount=max_ammo;
		}
		SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);
		return Plugin_Continue;
	}
		
    }

    CloseHandle(datapack);
    return Plugin_Stop;
}
Added to project.inc

Under
Code:
new g_iActiveWeaponOffset;
Added

Code:
new g_iAmmoTypeOffset;
Under
Code:
enum UpgradeConfigs
{
    UpgradeConfig_Disable,
    UpgradeConfig_TeamLock,
    UpgradeConfig_Effects,
    UpgradeConfig_MaxLevel,
    UpgradeConfig_Cost,
    UpgradeConfig_iCost,
    Float:UpgradeConfig_Interval,
    UpgradeConfig_MinAlpha,
    Float:UpgradeConfig_Percent,
    Float:UpgradeConfig_Amount,
    UpgradeConfig_Suicide,
    UpgradeConfig_Unlimited,
    UpgradeConfig_Mode,
    UpgradeConfig_TotalFreeze,
	Float:UpgradeConfig_BaseAmount,
	Float:UpgradeConfig_BaseSpeed,
	Float:UpgradeConfig_Speed,
    String:UpgradeConfig_Sound[64]
}
added

Code:
enum Slots
{
	SlotPrimary,
	SlotSecondary,
	SlotKnife,
	SlotGrenade,
	SlotC4,
	SlotNone
}

Added on helpers.inc

Under

Code:
    g_iActiveWeaponOffset=FindSendPropOffs("CAI_BaseNPC", "m_hActiveWeapon");
    if(g_iActiveWeaponOffset==-1)
        LogMgr_Print(g_moduleCore, LogType_Fatal_Plugin, "InitOffsets", "PLUGIN STOPPED - Reason: could not find the ActiveWeapon offset - PLUGIN STOPPED");
Added

Code:
    g_iAmmoTypeOffset = FindSendPropOffs("CBaseCombatWeapon", "m_iPrimaryAmmoType");
    if(g_iAmmoTypeOffset==-1)
        LogMgr_Print(g_moduleCore, LogType_Fatal_Plugin, "InitOffsets", "PLUGIN STOPPED - Reason: could not find the AmmoTypeOffset offset - PLUGIN STOPPED");
Attached is compiled version with the includes that have been modified.

This also fixes the bug with only regening one type of ammo :/ but.... if the user switches weapons, they will need to fire their new weapon. I will be eventually moving the code of getting the weapon to its own section and calling it from weapon fire. Then also creating an additional timer with a delay under the else statement that closes the datapack and will re-check the new weapon after default time for the give ammo. I will post when im done with that and have tested this further.

**NOTE** I HAVE NOT YET UPDATED THE STOCK MAX_AMMO ACCORDING TO THE AMMO TYPE. IF SOMEONE HAS A LIST OF ALL WEAPONS IN CSGO WITH THEIR AMMO TYPES THAT WOULD BE AWWWEESOME (I lost the copy I thought I had bookmarked and can't find it again)
Attached Files
File Type: inc regen_ammo.inc (12.0 KB, 195 views)
File Type: inc helpers.inc (15.8 KB, 182 views)
File Type: inc project.inc (18.7 KB, 177 views)
File Type: smx thc_rpg.smx (107.4 KB, 186 views)

Last edited by JZServices; 02-15-2014 at 05:32.
JZServices is offline
coty9090
Senior Member
Join Date: Aug 2007
Old 02-25-2014 , 19:55   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #32

Quote:
Originally Posted by JZServices View Post
Ok, here is a version with the previous two fixes and a possible regen ammo fix. I haven't had time testing it yet.

Modified on regen_ammo.inc regen_ammo_WeaponFire and Timer_OnRegen_ammoInterval

Code:
public regen_ammo_WeaponFire(client, const String:weapon[])
{
    if(IsValidPlayer(client))
        if(GetClientTeam(client)!=g_regen_ammoUpgradeConfigCache[UpgradeConfig_TeamLock])
        {
            if(GetPlayerUpgradeLevel(client,g_moduleregen_ammo)&&!g_bPlayerIsRegeneratingAmmo[client])
            {
        //originial code
        //static ammoCounts[] = { 0, 35, 90, 90, 200, 30, 120, 32, 100, 52, 100, 1, 1, 1, 1, 1 };
        
        static ammoCounts[] = { 0, 501, 502, 503, 504, 505, 506, 507, 508, 509, 510, 511, 512, 0, 0, 0, 0, 0, 0 };
            
        //ADDED THIS IN TO CREATE MAX AMMO COUNT BASED UPON AMMO TYPE VERY SIMPLE AND SHOULD ACTUALLY BE USED IN CSS VERSION INSTEAD OF CPU INTENSIVE CHECKS
        //NO TIME ATM TO MAKE MAX AMMO AMOUNTS POSSIBLY CREATE A CONFIG FILE FOR THIS IN THE FUTURE TOO
        
        
        //1 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_50AE", 2, 1, 0, 0, "ammo_50AE_max", "ammo_50AE_impulse", 0, 10, 14);
        //2 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_762MM", 2, 1, 0, 0, "ammo_762mm_max", "ammo_762mm_impulse", 0, 10, 14);
        //3 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM", 2, 1, 0, 0, "ammo_556mm_max", "ammo_556mm_impulse", 0, 10, 14);
        //4 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM_SMALL", 2, 1, 0, 0, "ammo_556mm_small_max", "ammo_556mm_impulse", 0, 10, 14);
        //5 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_556MM_BOX", 2, 1, 0, 0, &unk_CCACEF, "ammo_556mm_box_impulse", 0, 10, 14);
        //6 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_338MAG", 2, 1, 0, 0, "ammo_338mag_max", "ammo_338mag_impulse", 0, 12, 16);
        //7 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_9MM", 2, 1, 0, 0, "ammo_9mm_max", "ammo_9mm_impulse", 0, 5, 10);
        //8 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_BUCKSHOT", 2, 1, 0, 0, "ammo_buckshot_max", "ammo_buckshot_impulse", 0, 3, 6);
        //9 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_45ACP", 2, 1, 0, 0, "ammo_45acp_max", "ammo_45acp_impulse", 0, 6, 10);
        //10 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_357SIG", 2, 1, 0, 0, "ammo_357sig_max", "ammo_357sig_impulse", 0, 4, 8);
        //11 CAmmoDef::AddAmmoType(ammoDef, &unk_CCAE47, 2, 1, 0, 0, "ammo_357sig_small_max", "ammo_357sig_impulse", 0, 4, 8);
        //12 CAmmoDef::AddAmmoType(ammoDef, "BULLET_PLAYER_57MM", 2, 1, 0, 0, "ammo_57mm_max", "ammo_57mm_impulse", 0, 4, 8);
        //13 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_HEGRENADE", 64, 1, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
        //14 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_FLASHBANG", 0, 1, 0, 0, "ammo_grenade_limit_flashbang", 0, 0, 0, 8);
        //15 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_SMOKEGRENADE", 0, 1, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
        //16 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_MOLOTOV", 8, 0, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
        //17 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_DECOY", 0, 0, 0, 0, "ammo_grenade_limit_default", 0, 0, 0, 8);
        //18 CAmmoDef::AddAmmoType(ammoDef, "AMMO_TYPE_TASERCHARGE", 256, 3, 0, 0, 0, 0, 0, 0, 8);
        new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
        if (activeWeapon != -1)
        {
            new primary = GetPlayerWeaponSlot(client, _:SlotPrimary);
            new secondary = GetPlayerWeaponSlot(client, _:SlotSecondary);
                
            if ((activeWeapon == primary) || (activeWeapon == secondary))
            {    
                new ammoType = GetEntData(activeWeapon, g_iAmmoTypeOffset);
                new max_ammo=ammoCounts[ammoType];
                if (ammoType != -1){g_bPlayerIsRegeneratingAmmo[client]=true;new Handle:datapack=CreateDataPack();WritePackCell(datapack, client);WritePackCell(datapack, max_ammo);WritePackCell(datapack, ammoType);WritePackCell(datapack, activeWeapon);CreateTimer(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Interval],Timer_OnRegen_ammoInterval,datapack,TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);}
            }
        }
            }
        }
}

public Action:Timer_OnRegen_ammoInterval(Handle:timer,Handle:datapack)
{
    ResetPack(datapack);
    new client=ReadPackCell(datapack);
    new max_ammo=ReadPackCell(datapack);
    new ammoType=ReadPackCell(datapack);
    new oldactiveWeapon=ReadPackCell(datapack);

    if(IsClientInGame(client)&&g_bPlayerIsRegeneratingAmmo[client])
    {
        new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
        if (activeWeapon==oldactiveWeapon)
        {
        new amount=GetEntData(client,g_iAmmoOffset+(ammoType*4),4)+RoundToNearest(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Amount]*GetPlayerUpgradeLevel(client,g_moduleregen_ammo));
        if(amount>max_ammo)
        {
            g_bPlayerIsRegeneratingAmmo[client]=false;
            amount=max_ammo;
        }
        SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);
        return Plugin_Continue;
    }
        
    }

    CloseHandle(datapack);
    return Plugin_Stop;
}
Added to project.inc

Under
Code:
new g_iActiveWeaponOffset;
Added

Code:
new g_iAmmoTypeOffset;
Under
Code:
enum UpgradeConfigs
{
    UpgradeConfig_Disable,
    UpgradeConfig_TeamLock,
    UpgradeConfig_Effects,
    UpgradeConfig_MaxLevel,
    UpgradeConfig_Cost,
    UpgradeConfig_iCost,
    Float:UpgradeConfig_Interval,
    UpgradeConfig_MinAlpha,
    Float:UpgradeConfig_Percent,
    Float:UpgradeConfig_Amount,
    UpgradeConfig_Suicide,
    UpgradeConfig_Unlimited,
    UpgradeConfig_Mode,
    UpgradeConfig_TotalFreeze,
    Float:UpgradeConfig_BaseAmount,
    Float:UpgradeConfig_BaseSpeed,
    Float:UpgradeConfig_Speed,
    String:UpgradeConfig_Sound[64]
}
added

Code:
enum Slots
{
    SlotPrimary,
    SlotSecondary,
    SlotKnife,
    SlotGrenade,
    SlotC4,
    SlotNone
}
Added on helpers.inc

Under

Code:
    g_iActiveWeaponOffset=FindSendPropOffs("CAI_BaseNPC", "m_hActiveWeapon");
    if(g_iActiveWeaponOffset==-1)
        LogMgr_Print(g_moduleCore, LogType_Fatal_Plugin, "InitOffsets", "PLUGIN STOPPED - Reason: could not find the ActiveWeapon offset - PLUGIN STOPPED");
Added

Code:
    g_iAmmoTypeOffset = FindSendPropOffs("CBaseCombatWeapon", "m_iPrimaryAmmoType");
    if(g_iAmmoTypeOffset==-1)
        LogMgr_Print(g_moduleCore, LogType_Fatal_Plugin, "InitOffsets", "PLUGIN STOPPED - Reason: could not find the AmmoTypeOffset offset - PLUGIN STOPPED");
Attached is compiled version with the includes that have been modified.

This also fixes the bug with only regening one type of ammo :/ but.... if the user switches weapons, they will need to fire their new weapon. I will be eventually moving the code of getting the weapon to its own section and calling it from weapon fire. Then also creating an additional timer with a delay under the else statement that closes the datapack and will re-check the new weapon after default time for the give ammo. I will post when im done with that and have tested this further.

**NOTE** I HAVE NOT YET UPDATED THE STOCK MAX_AMMO ACCORDING TO THE AMMO TYPE. IF SOMEONE HAS A LIST OF ALL WEAPONS IN CSGO WITH THEIR AMMO TYPES THAT WOULD BE AWWWEESOME (I lost the copy I thought I had bookmarked and can't find it again)
In CS:S. The regen ammo only works once after you first fire the weapon, but if you switch weapons it stops regenerating. Is there a way to make both weapons regen ammo simultaneously and no need to fire the weapon? Needing to fire the weapon first is a flawed way to do it in my opinion. (example: What if there's no ammo to fire?)...

How can the percentage exp be fixed? It isn't working at all.

Last edited by coty9090; 02-27-2014 at 12:54.
coty9090 is offline
JZServices
Member
Join Date: Jul 2013
Old 03-01-2014 , 19:40   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #33

Quote:
Originally Posted by coty9090 View Post
In CS:S. The regen ammo only works once after you first fire the weapon, but if you switch weapons it stops regenerating. Is there a way to make both weapons regen ammo simultaneously and no need to fire the weapon? Needing to fire the weapon first is a flawed way to do it in my opinion. (example: What if there's no ammo to fire?)...

How can the percentage exp be fixed? It isn't working at all.
I forgot, i fixed this but didn't post. I have been working 14-17 hour days recently.

Code:
public Action:Timer_OnRegen_ammoInterval(Handle:timer,Handle:datapack)
{
    ResetPack(datapack);
    new client=ReadPackCell(datapack);
    new max_ammo=ReadPackCell(datapack);
    new ammoType=ReadPackCell(datapack);
    new oldactiveWeapon=ReadPackCell(datapack);
    if(client>0&&client<MaxClients&&IsClientInGame(client)&&IsPlayerAlive(client)&&g_bPlayerIsRegeneratingAmmo[client])
    {
    	    new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
    	    if (activeWeapon==oldactiveWeapon)
    	    {
    	    	    new amount=GetEntData(client,g_iAmmoOffset+(ammoType*4),4)+RoundToNearest(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Amount]*GetPlayerUpgradeLevel(client,g_moduleregen_ammo));
    	    	    if(amount>max_ammo){g_bPlayerIsRegeneratingAmmo[client]=false;amount=max_ammo;SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);CloseHandle(datapack);return Plugin_Stop;}
		    else{SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);return Plugin_Continue;}
	    }
	    else
	    {
		    //originial code
		    //new ammoCounts[]= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
		    //if (cstrike){ammoCounts={0,512,2047,2047,2047,1024,1024,512,2047,512,2047,0,0,0,0,0,0,0,0};}
		    //else if (csgo){ammoCounts={0,450,1050,1050,900,1500,300,1050,450,1200,600,450,1200,0,0,0,0,0,0};}
		    
		    //if (debugcode){PrintToServer("We detected a change in weapons for player number %d",client);}
		
		    if (activeWeapon != -1)
		    {
			    new primary = GetPlayerWeaponSlot(client, _:SlotPrimary);
			    new secondary = GetPlayerWeaponSlot(client, _:SlotSecondary);
						    
			    if ((activeWeapon == primary) || (activeWeapon == secondary))
			    {    
				    ammoType = GetEntData(activeWeapon, g_iAmmoTypeOffset);
				    max_ammo=ammoCounts[ammoType];
				    if (ammoType != -1)
				    {
				    	new amount=GetEntData(client,g_iAmmoOffset+(ammoType*4),4)+RoundToNearest(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Amount]*GetPlayerUpgradeLevel(client,g_moduleregen_ammo));
				    	if(amount>max_ammo){g_bPlayerIsRegeneratingAmmo[client]=false;amount=max_ammo;SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);g_bPlayerIsRegeneratingAmmo[client]=false;CloseHandle(datapack);return Plugin_Stop;}
				    	else{SetEntData(client,g_iAmmoOffset+(ammoType*4),amount,4,true);ResetPack(datapack);WritePackCell(datapack, client);WritePackCell(datapack, max_ammo);WritePackCell(datapack, ammoType);WritePackCell(datapack, activeWeapon);return Plugin_Continue;}
				    }
			    }
		    }
	    }
	    	    
    }
    g_bPlayerIsRegeneratingAmmo[client]=false;
    CloseHandle(datapack);
    return Plugin_Stop;
}
add this line to the regen_ammo.inc file
Code:
public regen_ammo_Calculate(client)
{
	//originial code
	//new ammoCounts[]= { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
	//if (cstrike){ammoCounts={0,512,2047,2047,2047,1024,1024,512,2047,512,2047,0,0,0,0,0,0,0,0};}
	//STARTING AMMO AMOUNTS else ////if (csgo){ammoCounts={0,150,350,350,300,500,150,350,150,400,200,150,400,0,0,0,0,0,0};}
	//else if (csgo){ammoCounts={0,450,1050,1050,900,1500,300,1050,450,1200,600,450,1200,0,0,0,0,0,0};}

	new activeWeapon = GetEntDataEnt2(client, g_iActiveWeaponOffset);
	if (activeWeapon != -1)
	{
		new primary = GetPlayerWeaponSlot(client, _:SlotPrimary);
		new secondary = GetPlayerWeaponSlot(client, _:SlotSecondary);
		    	    	    	    
		if ((activeWeapon == primary) || (activeWeapon == secondary))
		{    
			new ammoType = GetEntData(activeWeapon, g_iAmmoTypeOffset);
			new max_ammo=ammoCounts[ammoType];
			if (ammoType != -1){g_bPlayerIsRegeneratingAmmo[client]=true;new Handle:datapack=CreateDataPack();WritePackCell(datapack, client);WritePackCell(datapack, max_ammo);WritePackCell(datapack, ammoType);WritePackCell(datapack, activeWeapon);CreateTimer(g_regen_ammoUpgradeConfigCache[UpgradeConfig_Interval],Timer_OnRegen_ammoInterval,datapack,TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);}
		}
	}
}

modify the weaponfire to be this:


Code:
		    if(IsValidPlayer(client))
		    {
		    	    if(GetPlayerUpgradeLevel(client,g_moduleregen_ammo)&&!g_bPlayerIsRegeneratingAmmo[client])
		    	    {
		    	    	    regen_ammo_Calculate(client);
			    }
		    }

Ill post the files when i get a chance. I just got home from work and dont have it in the official release as i have my custom version that i pulled code from.
JZServices is offline
coty9090
Senior Member
Join Date: Aug 2007
Old 03-04-2014 , 02:07   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #34

Thanks, I also noticed that when you get damaged in between rounds, your health will stay at that health amount into the next round. (wont reset hp to health upgrade amount the next round, and regen hp wont work until you get damaged that next round too.)

**EDIT**

I edited the file with that code and regen ammo works better then it did, but still on/off at times. Noticed switching to grenades or the bomb stops it from working completely and not letting it regenerate to max ammo (500-503 ammo) makes it stop working some times.

Last edited by coty9090; 03-04-2014 at 13:30.
coty9090 is offline
JZServices
Member
Join Date: Jul 2013
Old 03-05-2014 , 15:00   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #35

The code was intended to regen ammo not grenades. The original code did a very hackish way to check this and when 20 people are using regen ammo, it used a lot of cpu. The numbers 500-503 or whatever are all put in as testing. I requested someone to go through all the weapons and paste ammo types for it but haven't heard back.

Grenades would need to be added by using a new


Code:
grenade = GetPlayerWeaponSlot(client, _:SlotGrenade);
						    
			    if ((activeWeapon == primary) || (activeWeapon == secondary))
			    {

I would probably start switching this to a bool with the count of the weaponslots and using

Code:
if (b_acceptedWeapon[activeWeapon])

Just thoughts of increasing efficiency of the code

I believe this is the current slot order asisgned too:

Code:
enum Slots
{
	SlotPrimary,
	SlotSecondary,
	SlotKnife,
	SlotGrenade,
	SlotC4,
	SlotNone
}
Not sure if it needs to be updated

And while we are at it, might want to add code to kill and restart the timer too on weapon drop.

I'll polish all these things up and let u know how to disable the Grenades. But for the time being! I need the current weapons and ammo types in relation to:

ammoCounts={0,450,1050,1050,900,1500,300,1050 ,450,1200,600,450,1200,0,0,0,0,0,0};
JZServices is offline
coty9090
Senior Member
Join Date: Aug 2007
Old 03-05-2014 , 17:16   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #36

I didn't mean that regen ammo should regen grenades, i meant that when you regen ammo, switch to grenade (or bomb), and switch back to your weapon again regen ammo stops working.

Looks about the same as yours, but searching the web i noticed Zombie Reloaded uses this.

enum WeaponsSlot
{
Slot_Invalid = -1, /** Invalid weapon (slot). */
Slot_Primary = 0, /** Primary weapon slot. */
Slot_Secondary = 1, /** Secondary weapon slot. */
Slot_Melee = 2, /** Melee (knife) weapon slot. */
Slot_Projectile = 3, /** Projectile (grenades, flashbangs, etc) weapon slot. */
Slot_Explosive = 4, /** Explosive (c4) weapon slot. */
Slot_NVGs = 5, /** NVGs (fake) equipment slot. */
}

and for the ammo types, that is a bit harder to find in relation to ammoCounts={0,450,1050,1050,900,1500,300,1050 ,450,1200,600,450,1200,0,0,0,0,0,0};
instead of like ammo_338mag_max lol :p

Also, I tried your core.inc that you put up in the original thread that made thc rpg and store plugin work together, but it didn't work...

Last edited by coty9090; 03-11-2014 at 01:57.
coty9090 is offline
Dam0cleS
New Member
Join Date: Mar 2014
Old 03-08-2014 , 10:44   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #37

Hey! It may be a stupid question, but what skill gives you the red lines when you're shooting someone?
Dam0cleS is offline
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 03-08-2014 , 11:04   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #38

Quote:
Originally Posted by Dam0cleS View Post
Hey! It may be a stupid question, but what skill gives you the red lines when you're shooting someone?
I think the vampire one here.
__________________
Peace-Maker is offline
JZServices
Member
Join Date: Jul 2013
Old 03-11-2014 , 05:11   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #39

Quote:
Originally Posted by coty9090 View Post
I didn't mean that regen ammo should regen grenades, i meant that when you regen ammo, switch to grenade (or bomb), and switch back to your weapon again regen ammo stops working.

Looks about the same as yours, but searching the web i noticed Zombie Reloaded uses this.

enum WeaponsSlot
{
Slot_Invalid = -1, /** Invalid weapon (slot). */
Slot_Primary = 0, /** Primary weapon slot. */
Slot_Secondary = 1, /** Secondary weapon slot. */
Slot_Melee = 2, /** Melee (knife) weapon slot. */
Slot_Projectile = 3, /** Projectile (grenades, flashbangs, etc) weapon slot. */
Slot_Explosive = 4, /** Explosive (c4) weapon slot. */
Slot_NVGs = 5, /** NVGs (fake) equipment slot. */
}

and for the ammo types, that is a bit harder to find in relation to ammoCounts={0,450,1050,1050,900,1500,300,1050 ,450,1200,600,450,1200,0,0,0,0,0,0};
instead of like ammo_338mag_max lol :p

Also, I tried your core.inc that you put up in the original thread that made thc rpg and store plugin work together, but it didn't work...
I have made changes to the core.inc... I have a working version for all standard weapons (pistols rifles etc) but did not enable grenades with the modified .inc file. I will post son.
JZServices is offline
coty9090
Senior Member
Join Date: Aug 2007
Old 04-01-2014 , 20:40   Re: [THC RPG CS:GO] Total HardCore RPG
Reply With Quote #40

Quote:
Originally Posted by JZServices View Post
I have made changes to the core.inc... I have a working version for all standard weapons (pistols rifles etc) but did not enable grenades with the modified .inc file. I will post son.
Have you fixed the exp_max config in your version too? When players reach max exp, they can't level up anymore. Shouldn't it just cap required exp and stay at max exp after each level after that?

*EDIT*... damn, just noticed that's not how it works...

Also, i would like to know how regen grenade levels work. I understand it's by chance, but is lvl 10 (default) 10% chance? and if i increased the max level to say 100, would it be 100% chance?

Last edited by coty9090; 04-01-2014 at 20:58.
coty9090 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 23:52.


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