Jump to content

  •  

Photo

[Check Same IP] and [TIMER] NPC Help.


  • Please log in to reply
No replies to this topic

#1 DearDrew

DearDrew

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 25 October 2016 - 12:22 PM

prontera,148,178,5 script BlessingAngel 501,{
SC_START SC_BLESSING,240000,10;
SC_START SC_INCREASEAGI,240000,10;
sc_start SC_ASSUMPTIO,240000,5;
sc_start SC_MAGNIFICAT,240000,10;
percentheal 100,100;
end;

OnInit:
waitingroom "-Blessing Angel-",0;


end;
}

I would like to set a timer to this script that the user can only use this funtion every 10min. the npc will also tell you the time remaining of next use.  How should i add to that?

 

function	script	dayitem	{
	
//=======================//
	setarray .@item[1],668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668,668;

//=============//
	setarray .@num[1],1,2,3,4,5,6,7,8,9,10,10,10,10,10,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15;
	
//===================//
	setarray .@add,5,10,15,20,25;

//==============================//
	setarray .@aitem[0],21600,21600,21600,21600,21600;

//===========//
	setarray .@anum[0],1,1,1,1,1;
	
//================================================//

for ( set .@i,0; .@i<getarraysize(.@add); set .@i,.@i+1 )
{
	if ( getArg(0) == .@add[.@i] )
	{
		set .@j,1;
		getitem .@aitem[.@i],.@anum[.@i];
		break;
	}
}	
	set .@dayn,gettime(5);
	getitem .@item[.@dayn],.@num[.@dayn];
	announce "============================================",bc_self,0xCD1039;
	announce "==                                        ",bc_self,0xFF7F50;
	announce "==       You have Logged in [ "+getarg(0)+" ] days",bc_self,0xFFDC3C;
	announce "==                                        ",bc_self,0x80E12A;
	announce "==         The Price for Today is.. !!!         ",bc_self,0x00BFFF;
	announce "==                                        ",bc_self,0x7B68EE;
	if ( .@j ) { announce "==    "+.@num[.@dayn]+"  [ "+getitemname(.@item[.@dayn])+" ] and extra "+.@anum[.@i]+"  [ "+getitemname(.@aitem[.@i])+" ] 	",bc_self,0x00000; }
	else { announce "==          "+.@num[.@dayn]+"  [ "+getitemname(.@item[.@dayn])+" ]  	",bc_self,0x00000; }
	announce "==                                        ",bc_self,0x9932CC;
	announce "==  The price can be different every day!>.0  ",bc_self,0xF08080;
	announce "==                                        ",bc_self,0x00E1F0;
	announce "============================================",bc_self,0x783C3C;
	end;
}

-	script	daylogin	-1,{
		
OnPCLoginEvent:

	if( gettime(7)%4==0 ) set .@pr,1;
	if ( #daytime >= 366+.@pr )  set #daytime,1; 
if ( #daytime )
	{
		if ( #daytime == gettime(8) )
		{
			set #daytime,gettime(8)+1;
			set #daylogin,#daylogin+1;
			callfunc "dayitem",#daylogin;
			end;
		}
		if ( #daytime < gettime(8) && #daytime != 1 )
		{
			set #daytime,gettime(8)+1;
			set #daylogin,1;
			callfunc "dayitem",1;
			end;
		}
		end;
	}
		set #daytime,gettime(8)+1;
		set #daylogin,1;
		callfunc "dayitem",1;
		end;
}	

This is a daily reward system, but H\how do i add a IP check to this script, so only 1 acct from same ip can get the price? 






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users


This topic has been visited by 21 user(s)