Jump to content
  • 0

HELP WITH POINTS I DONT WANT NEGATIVE VALUES


kyleanthonydizon

Question


  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  100
  • Reputation:   0
  • Joined:  10/22/16
  • Last Seen:  

-	script	PvPPoints	-1,{

OnInit:
	set .Delay,180;
	setarray $PVPMAPS1$[0],"guild_vs2","guild_vs3"; //you can add more maps here
	end;

OnPCKillEvent:
	if (getcharid(0))	
		for(set .@i,0; .@i < getarraysize($PVPMAPS1$); set .@i,.@i+1) {
			if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
				if( @Delay < gettimetick(2) ){
				set .@Amount,1;
				set #PVPPOINTS,#PVPPOINTS + .@Amount;
				dispbottom "Gained "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" PvP Points.";
				if( .Delay ) set @Delay,gettimetick(2) + .Delay;
				}
			}
		}
	end;

OnPCDieEvent:
	if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
		if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
			set .@Amount,1;
			set #PVPPOINTS,#PVPPOINTS - .@Amount;
			dispbottom "Lost "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" Cash Points.";
			end;
	}

}

How will I catch like, If PVPPoints <= 0  it will not minus 1 points.

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3128
  • Reputation:   1617
  • Joined:  03/26/12
  • Last Seen:  

-	script	PvPPoints	-1,{

OnInit:
	.Delay = 180;
	setarray $PVPMAPS1$[0],"guild_vs2","guild_vs3"; //you can add more maps here
	end;

OnPCKillEvent:
	if (getcharid(0))	
		for(set .@i,0; .@i < getarraysize($PVPMAPS1$); set .@i,.@i+1) {
			if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
				if( @Delay < gettimetick(2) ){
					.@Amount = 1;
					#PVPPOINTS += .@Amount;
					dispbottom "Gained "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" PvP Points.";
					if( .Delay ){ @Delay = gettimetick(2) + .Delay; }
				}
			}
		}
	end;

OnPCDieEvent:
	if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
		if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
			.@Amount = 1;
			if(#PVPPOINTS >= .@Amount) {
				#PVPPOINTS -= .@Amount;
				dispbottom "Lost "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" Cash Points.";
			} else {
				//dispbottom "Attempting to subtract more points than the player owns.";
				// You could optionally just reset to 0 here too
				//#PVPPOINTS = 0;
			}
			end;
		}
	}
	end;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  27
  • Topics Per Day:  0.01
  • Content Count:  100
  • Reputation:   0
  • Joined:  10/22/16
  • Last Seen:  

On 5/7/2017 at 10:15 AM, Akkarin said:

-	script	PvPPoints	-1,{

OnInit:
	.Delay = 180;
	setarray $PVPMAPS1$[0],"guild_vs2","guild_vs3"; //you can add more maps here
	end;

OnPCKillEvent:
	if (getcharid(0))	
		for(set .@i,0; .@i < getarraysize($PVPMAPS1$); set .@i,.@i+1) {
			if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
				if( @Delay < gettimetick(2) ){
					.@Amount = 1;
					#PVPPOINTS += .@Amount;
					dispbottom "Gained "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" PvP Points.";
					if( .Delay ){ @Delay = gettimetick(2) + .Delay; }
				}
			}
		}
	end;

OnPCDieEvent:
	if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
		if(strcharinfo(3) == $PVPMAPS1$[.@i]) {
			.@Amount = 1;
			if(#PVPPOINTS >= .@Amount) {
				#PVPPOINTS -= .@Amount;
				dispbottom "Lost "+.@Amount+" Cash Point. Total = "+#PVPPOINTS+" Cash Points.";
			} else {
				//dispbottom "Attempting to subtract more points than the player owns.";
				// You could optionally just reset to 0 here too
				//#PVPPOINTS = 0;
			}
			end;
		}
	}
	end;
}

 

Thank you, will give this a try :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...