Jump to content
  • 0

AFK on specific map


Bradium

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  04/04/13
  • Last Seen:  

Hello,

 

Can anyone help me do this?

People will warp through 'warper' to go to a specific AFK map; in there he gets 1 cashpoint per 3 minutes. (Everyone will only get cashpoint from that map)

 

-	script	hourlypoints	-1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;

if(@map$ == "jupe_ele")	{
OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
	dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
//Check if Idle
getmapxy( .@map$, .@x, .@y, 0 );
if(@map$ == .@map$ && @x == .@x && @y == .@y) {
	set @afk, @afk + 1;
}
//If move timer resets
else {
	set @afk, 0;
}
	set @map$, .@map$; set @x, .@x; set @y, .@y;
//Idle Check for 5 Minutes
if(@afk == 99999999) {
	dispbottom "The hourly points event stopped because you were idle. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
end;

OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 1){
	set @minute,0;
	set .@point_amt, 1; //Points to get every hour (default: 10)
	set #CASHPOINTS, #CASHPOINTS + .@point_amt;
	dispbottom "You received "+.@point_amt+" Cashpoint by staying ingame for a minute!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	set @consecutive_hour, @consecutive_hour + 1;
	}
//Check for 12 hours consecutive
	if(@consecutive_hour == 60) {
	set @consecutive_hour,0;
	set .@cpoint_amt, 20; //Points to get for 12 Consecutive hours (default: 50)
	set #CASHPOINTS, #CASHPOINTS + .@cpoint_amt;
	dispbottom "You receive "+.@cpoint_amt+" Cashpoints by staying ingame for an hour!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	}

stopnpctimer;
initnpctimer;
end;
}
else {}

}

 

Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  491
  • Reputation:   19
  • Joined:  11/19/11
  • Last Seen:  

On 6/4/2013 at 10:58 PM, Bradium said:

Hi capuche,

Thank you very much for being so kind but this script below is what I really wanted with a twist.

Could you add a specific area for the cashpoints to run? And if the player goes out of that area he/she will not gonna get any cashpoints.

Also, the reason why I wanted this script coz it prevents people getting cashpoint while they're afk.


-	script	hourlypoints	-1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;


OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
	dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
//Check if Idle
getmapxy( .@map$, .@x, .@y, 0 );
if(@map$ == .@map$ && @x == .@x && @y == .@y) {
	set @afk, @afk + 1;
}
//If move timer resets
else {
	set @afk, 0;
}
	set @map$, .@map$; set @x, .@x; set @y, .@y;
//Idle Check for 5 Minutes
if(@afk == 99999999) {
	dispbottom "The hourly points event stopped because you were idle. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
end;

OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 1){
	set @minute,0;
	set .@point_amt, 1; //Points to get every hour (default: 10)
	set #CASHPOINTS, #CASHPOINTS + .@point_amt;
	dispbottom "You received "+.@point_amt+" Cashpoint by staying ingame for a minute!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	set @consecutive_hour, @consecutive_hour + 1;
	}
//Check for 12 hours consecutive
	if(@consecutive_hour == 60) {
	set @consecutive_hour,0;
	set .@cpoint_amt, 20; //Points to get for 12 Consecutive hours (default: 50)
	set #CASHPOINTS, #CASHPOINTS + .@cpoint_amt;
	dispbottom "You receive "+.@cpoint_amt+" Cashpoints by staying ingame for an hour!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	}

stopnpctimer;
initnpctimer;
end;


}

any update sir ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  04/04/13
  • Last Seen:  

Bumping!

Please also add if he / she is out of the map the cashpoints should also be stopped adding. 

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

An afk map.. that means the guy get points even if he is afk ? then try this :

 

-	script	hourlypoints	-1,{
OnInit:
	setarray .@map_name$, "prontera";	// your afk map

	.compile_map$ = implode( .@map_name$, "|" );
	.@size = getarraysize( .@map_name$ );
	while ( .@i < .@size ) {
		setmapflag .@map_name$[.@i],mf_loadevent;
		.@i++;
	}
	end;
OnPCLoadMapEvent:
	attachnpctimer strcharinfo(0);
	initnpctimer;
	end;
OnTimer10000:
	if ( compare( .compile_map$,strcharinfo(3) ) ) {
		@point_afk_onmap++;
		if ( @point_afk_onmap == 18 ) {
			@point_afk_onmap = 0;
			dispbottom "Gain: 1 Cashpoint.";
			#CASHPOINTS = #CASHPOINTS + 1;
		}
		initnpctimer;
	}
	else {
		@point_afk_onmap = 0;
		stopnpctimer;
	}
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  04/04/13
  • Last Seen:  


parse_line: expect command, missing function name or calling undeclared function

123 : {

124 : OnInit:

125 : setarray .@map_name$, "jupe_ele"; // your afk map

126 :

* 127 : '.'compile_map$ = implode( .@map_name$, "|" );

128 : .size = getarraysize( .@map_name$ );

129 : while ( .@i < .@size ) {

130 : setmapflag .@map_name$[.@i],mf_loadevent;

131 : .@i++;

132 : }

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

You don't use rA ? try this one :

-	script	hourlypoints	-1,{
OnInit:
	setarray .@map_name$, "prontera";	// your afk map

	set .compile_map$, implode( .@map_name$, "|" );
	set .@size, getarraysize( .@map_name$ );
	while ( .@i < .@size ) {
		setmapflag .@map_name$[.@i],mf_loadevent;
		set .@i, .@i +1;
	}
	end;
OnPCLoadMapEvent:
	attachnpctimer strcharinfo(0);
	initnpctimer;
	end;
OnTimer10000:
	if ( compare( .compile_map$,strcharinfo(3) ) ) {
		set @point_afk_onmap, @point_afk_onmap +1;
		if ( @point_afk_onmap == 18 ) {
			set @point_afk_onmap, 0;
			dispbottom "Gain: 1 Cashpoint.";
			set #CASHPOINTS, #CASHPOINTS + 1;
		}
		initnpctimer;
	}
	else {
		set @point_afk_onmap, 0;
		stopnpctimer;
	}
	end;
}
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  18
  • Reputation:   0
  • Joined:  04/04/13
  • Last Seen:  

Hi capuche,

Thank you very much for being so kind but this script below is what I really wanted with a twist.

Could you add a specific area for the cashpoints to run? And if the player goes out of that area he/she will not gonna get any cashpoints.

Also, the reason why I wanted this script coz it prevents people getting cashpoint while they're afk.

-	script	hourlypoints	-1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;


OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
	dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
//Check if Idle
getmapxy( .@map$, .@x, .@y, 0 );
if(@map$ == .@map$ && @x == .@x && @y == .@y) {
	set @afk, @afk + 1;
}
//If move timer resets
else {
	set @afk, 0;
}
	set @map$, .@map$; set @x, .@x; set @y, .@y;
//Idle Check for 5 Minutes
if(@afk == 99999999) {
	dispbottom "The hourly points event stopped because you were idle. Please relog if you wish to start again.";
	stopnpctimer;
	end;
}
end;

OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 1){
	set @minute,0;
	set .@point_amt, 1; //Points to get every hour (default: 10)
	set #CASHPOINTS, #CASHPOINTS + .@point_amt;
	dispbottom "You received "+.@point_amt+" Cashpoint by staying ingame for a minute!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	set @consecutive_hour, @consecutive_hour + 1;
	}
//Check for 12 hours consecutive
	if(@consecutive_hour == 60) {
	set @consecutive_hour,0;
	set .@cpoint_amt, 20; //Points to get for 12 Consecutive hours (default: 50)
	set #CASHPOINTS, #CASHPOINTS + .@cpoint_amt;
	dispbottom "You receive "+.@cpoint_amt+" Cashpoints by staying ingame for an hour!";
	dispbottom "Current Balance = "+#CASHPOINTS+" Cashpoints";
	}

stopnpctimer;
initnpctimer;
end;


}
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...