Raised This Month: $ Target: $400
 0% 

Code review


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-20-2009 , 15:23   Code review
Reply With Quote #1

Im not sure if it actully works but i would love if some one with much more scripting knowlage then me take a look at it.
Attached Files
File Type: sp Get Plugin or Get Source (bonus.sp - 171 views - 4.5 KB)
Doc-Holiday is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 07-20-2009 , 22:05   Re: Code review
Reply With Quote #2

Just by glancing through it, there are several problems.

I didn't try to compile but this is going to need work before that.

Bad:

Code:
new MoneyOffset = FindSendPropOffs("CCSPlayer", "m_iAccount");
Code:
public Action:OnBombPu(Handle:event, any:client)
See the event callback definition in events.inc

Code:
public Action:OnDefuseAttempt(Handle:event, any:client)
{
	new cash = GetConVarInt(defat);
	new playercash = GetEntDataEnt(client, MoneyOffset);
	
	if(GetConVarInt(Switch))
	{
		SetEntData(client, MoneyOffset, playercash + cash, 4, true)
		PrintHintText(client, "[SM] You have received a %d cash bonus for attempting to defuse the bomb!", cash)
		defatt++
	}
}
Give cash every time they start defusing? Exploited very easily.

Code:
new defatt = 0;
new platt = 0;
wat?

Code:
public Action:OnPlayerSpawn(Handle:event, any:client)
{
	defatt = 0;
	platt = 0;
}
Reset global vars for every spawn?

Code:
if(GetConVarInt(Switch) && )
:X

Code:
public Action:OnBombDefuse(Handle:event, any:client)
{
	new cash = GetConVarInt(defuse);
	new playercash = GetEntDataEnt(client, MoneyOffset);
	
	if(GetConVarInt(Switch))
	{
		if(GetClientTeam( client ) == CS_TEAM_CT && IsPlayerAlive(client))
		{
			SetEntData(Client, MoneyOffset, playercash + cash, 4, true)
			PrintHintText(client, "[SM] Your team has received a %d cash bonus for defusing the bomb!", cash)
		}
		else if(GetClienTeam( client ) == CS_TEAM_T)
		{
			SetEntData(Client, MoneyOffset, playercash - cash, 4, true)
			PrintHintText(client, "[SM] Your team has lost %d cash for not stoping the CT's!", cash)
		}
	}
}
When is the defuser ever gunna be T? Or dead? Also bolded a typo in there.



This is no where near compiling

Also, these most likely are not all the errors in the plugin, I found these by glancing around.
__________________

Last edited by Greyscale; 07-20-2009 at 22:08.
Greyscale is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 07-21-2009 , 00:29   Re: Code review
Reply With Quote #3

Ok so i changed a few things.

Got some errors on the compiler
function prototypes do not match
on the hook events
Attached Files
File Type: sp Get Plugin or Get Source (bonus.sp - 150 views - 7.6 KB)

Last edited by Doc-Holiday; 07-21-2009 at 01:59.
Doc-Holiday 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 19:27.


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