Problem with an exploit stopper stub

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
Nochte

Problem with an exploit stopper stub

Post by Nochte »

Ok, been working on this problem for a day or two for one of my friends. I've been out of the escript loop for better than a year and a half, and I know I'm missing something obvious.

The code posted here is just a stub representative of what I'm trying to do. When a player uses this command more than once every 5 seconds, he is supposed to adopt an "exploitCount" flag that is incremented every time he uses the command.

My problem: When getting the properties (using getObjProperty(..)) from the player, errortext is returned. I'm not quite getting why. Also--I know that the usingAbility is actually set, I've checked using .propedit.
Thanks in advance.

Code: Select all

use uo;
use cfgfile;
use os;

include "../pkg/character/abilities/abilities";

var abiCfgFile := ReadConfigFile( ":abilities:abilities" );

const TIME_BETWEEN_ABILITY_USES := 5;  //change this number to how long you wish the restriction to be; in seconds


program DotCommand( who, text )
	var abiElem;
	var usableAbilityArray := array;
	var params := array;

	var useAbility := CInt(GetObjProperty(who, "UsingAbility"));
	var exploitCount := CInt(GetObjProperty(who, "exploitCount"));
	var gameClock := (ReadGameClock());
	var useWaitTime := gameClock - TIME_BETWEEN_ABILITY_USES;




//debug code
SysLog("useWaitTime: " + (useWaitTime));
SysLog("gameClock " + (gameClock));
SysLog("useAbility " + CStr(useAbility));
SysLog("exploitCount " + CStr(exploitCount));
SysLog("");
SysLog("");
//end debug

	if (useAbility)
	//has he used an ability?

SysLog("If useAbility");//debug

		if(useAbility > useWaitTime)

SysLog("If useAbility > useWaitTime");//debug

		//has he used the ability in the last TIME_BETWEEN_ABILITY_USES seconds?
			SysLog(who.name + " is attempting to use the .ability exploit!");
			SendSysMessage(who, "Don't do that again...");
				
                     
			if(exploitCount)

SysLog("If exploitCount");//debug

			//has he exploited before?
				SetObjProperty(who, "exploitCount", CInt(exploitCount+1));
                        
				if(exploitCount > 9)

SysLog("If exploitCount > 9");//debug

				//habitual violator, kill him
					SetVital( who, "Life", 1 );
					ApplyRawDamage ( who, 200 );
					return;
				endif
				
				if(exploitCount > 4)

SysLog("If exploitCount > 4");//debug

				//habitual violator, kick him offline
					DisconnectClient(who);
					return;
				endif
			
			else
				//obviously not, set their counter up
				SetObjProperty(who, "exploitCount", CInt(1));
			endif
		endif
	endif
		
	//flag to let other iterations of this script know
	//when the last time it was used	
	SetObjProperty(who, "usingAbility", CInt(ReadGameClock()));

endprogram
edit: aww crap. "usingAbility" != "UsingAbility"
Post Reply