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

[ANY] BitchSlap 7/25/13


Post New Thread Reply   
 
Thread Tools Display Modes
ReZy
SourceMod Donor
Join Date: Dec 2012
Old 07-28-2013 , 22:08   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #11

Quote:
Originally Posted by Bara View Post
Memory Leak:
Going to fix that in v1.1.0
__________________
ReZy is offline
ReZy
SourceMod Donor
Join Date: Dec 2012
Old 07-28-2013 , 23:08   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #12

~-1.1.0-~
Added ProcessTargetString
Added 4 ConVars
Fixed memory leak issue
Fixed warnings
Attached Files
File Type: sp Get Plugin or Get Source (bitchslap.sp - 183 views - 3.5 KB)
__________________

Last edited by ReZy; 07-28-2013 at 23:12.
ReZy is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 07-28-2013 , 23:17   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #13

The memory leak will still be there, and whenever any cvar is changed, it will screw over the values of every single other cvar. Also your Float convar will be screwed up if it is changed at all.
necavi is offline
ReZy
SourceMod Donor
Join Date: Dec 2012
Old 07-28-2013 , 23:26   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #14

Quote:
Originally Posted by necavi View Post
The memory leak will still be there, and whenever any cvar is changed, it will screw over the values of every single other cvar. Also your Float convar will be screwed up if it is changed at all.
Will fix it later.
__________________
ReZy is offline
Civiccod PRO
Member
Join Date: Nov 2012
Old 07-28-2013 , 23:45   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #15

Quote:
The memory leak will still be there, and whenever any cvar is changed, it will screw over the values of every single other cvar. Also your Float convar will be screwed up if it is changed at all.

How about closing handle instead of killtimer??

and instead for OnPluginStart for GetConVarBool, use OnSettingsChange??

Code:
public Action:Timer_Slap(Handle:timer, any:iBuffer)
{
	new iClient = GetClientFromSerial(iBuffer);

	if (IsPlayerAlive(iClient) && (1 <= iClient <= MaxClients))
	{
		SlapPlayer(iClient, g_iSlapDamage, true);
    }
	else
	{
		timer = INVALID_HANDLE;
		
		CloseHandle(Handle:timer);
	}
}
Code:
public OnSettingsChange(Handle:cvar, const String:oldvalue[], const String:newvalue[])
{
    if (cvar == g_hEnabled)
    {
        g_bIsEnabled = GetConVarBool(g_hEnabled);
        g_iSlapDamage = GetConVarInt(g_hDamage);
        g_iMaxSlaps = GetConVarInt(g_hMaxSlap);
        g_fSlapInterval = GetConVarFloat(g_hSlapSpeed);
    }
}
__________________
Available for private plugins at request.

Contact Me

Last edited by Civiccod PRO; 07-28-2013 at 23:48.
Civiccod PRO is offline
necavi
Veteran Member
Join Date: Sep 2010
Old 07-28-2013 , 23:49   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #16

You do not need to close the handle of a timer. The issue is that you're creating a fuckton of timers at once, if the command is used more than a few times in a row it can trigger that error.
necavi is offline
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 07-29-2013 , 00:06   Re: [ANY] BitchSlap 7/25/13
Reply With Quote #17

Here's my contribution to your plugin - take what you want, or take nothing... just had a hankering to help

code


Use http://www.quickdiff.com/ to see the changes... I set all 4 spaces (and some 3 spaces) to tabs and adjusted the indentation of the ProcessTargetString...

hope it helps... also, this is untested and I'm not sure if my use of the static is appropriate or if it would even work.
__________________
View my Plugins | Donate
TnTSCS 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 20:47.


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