Jump to content
  • 0
pajodex

Help with my script. (Hourly points)

Question

-	script	hourlypoints	-1,{OnPCLoginEvent:	if(#limit == 1) { 			dispbottom "You have already reached the maximum points per day.";			dispbottom "Wait until the next day for the timer to start."; 			}	else { dispbottom "Hourly Points has been initiated in this account.";}	set #Clock,#minute;	set .@i, (gettime(7) * 365 * 24) + (gettime(8) * 24) + gettime(3);// this will set time of origional loging		if(.@i >= (#LastClock + .ResetHours)){			set #LastClock,.@i;			set #Clock,0;		} else { set #minute,#Clock; }	attachnpctimer();	startnpctimer();	end;OnTimer60000:	if(#limit == 1) { stopnpctimer(); }	else {	setarray .@h_maps$[0],"vend_zone","vip_lounge";		for (set .@a, 0; .@a < getarraysize(.@h_maps$); set .@a, .@a + 1) {			if(strcharinfo(3) == .@h_maps$[.@a]) {						dispbottom "Hourly points is restricted in this map.";						dispbottom "Please change map and relog if you wish to continue Hourly points.";						stopnpctimer();						end;			}		}	set #minute, #minute + 1;	if(#minute == 60){				set .point_amt, 1;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 1 hour";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 120){				set .point_amt, 2;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 2 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 240){				set .point_amt, 4;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 4 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 480){				set #minute,0;				set #limit,1;				set .point_amt, 13;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 8 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				sleep2 2000;				dispbottom "You have already reached the maximum points per day.";				dispbottom "Wait until 12:01 for the timer to start.";				}			stopnpctimer();			initnpctimer();	}	end;OnInit:	set .ResetHours,24;	OnClock0001:	set #minute,0;	set #limit,0;	sleep2 1000;	stopnpctimer();	initnpctimer();	dispbottom "Timer has been restarted.";	end;}

So here is my hourly script. Based on multiple hourly points i have seen, however, i have this problem. I want to reset #minute and #limit to 0 when the server ticks to the next day. This script does that but only if the player is online. if he/she is not online, it wont be reset-ed.

 

Share this post


Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

-	script	hourlypoints	-1,{OnPCLoginEvent:	if(#limit == 1) { 			dispbottom "You have already reached the maximum points per day.";			dispbottom "Wait until the next day for the timer to start."; 			}	else { dispbottom "Hourly Points has been initiated in this account.";}	set #Clock,#minute;	set .@i, (gettime(7) * 365 * 24) + (gettime(8) * 24) + gettime(3);// this will set time of origional loging		if(.@i >= (#LastClock + .ResetHours)){			set #LastClock,.@i;			set #Clock,0;		} else { set #minute,#Clock; }	attachnpctimer();	startnpctimer();	end;OnTimer60000:	if(#limit == 1) { stopnpctimer(); }	else {	setarray .@h_maps$[0],"vend_zone","vip_lounge";		for (set .@a, 0; .@a < getarraysize(.@h_maps$); set .@a, .@a + 1) {			if(strcharinfo(3) == .@h_maps$[.@a]) {						dispbottom "Hourly points is restricted in this map.";						dispbottom "Please change map and relog if you wish to continue Hourly points.";						stopnpctimer();						end;			}		}	set #minute, #minute + 1;	if(#minute == 60){				set .point_amt, 1;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 1 hour";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 120){				set .point_amt, 2;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 2 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 240){				set .point_amt, 4;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 4 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				}	if(#minute == 480){				set #minute,0;				set #limit,1;				set .point_amt, 13;				set #KAFRAPOINTS, #KAFRAPOINTS + .point_amt;				dispbottom "You received "+.point_amt+" Free Donation points for staying in-game for 8 hours";				dispbottom "Current Balance = "+#KAFRAPOINTS+" Free Donation Points";				sleep2 2000;				dispbottom "You have already reached the maximum points per day.";				dispbottom "Wait until 12:01 for the timer to start.";				}			stopnpctimer();			initnpctimer();	}	end;OnInit:	set .ResetHours,24;	end;OnClock0001:	query_sql "DELETE FROM `acc_reg_num_db` WHERE `key`='#minute' OR `key`='#limit'";	//Delete all entries for offline players	query_sql "SELECT `account_id` from `char` where `online`=1", .@account_id;	for (.@i=0; .@i < getarraysize(.@account_id); .@i++){	//Delete all cached entries of online players		if (attachrid(.@account_id[.@i])){			#limit = 0;			#minute = 0;		}	}	.@size = getarraysize(.@account_id);	deletearray .@account_id[0],.@size;	initnpctimer();	end;}

Here's the script, but too bad practice to make player online for 8 hours in a day

 

 

Use a SQL query. On cellphone so can't specify much. Try something like this on a backup:

 

DELETE FROM char_acc_reg_str where name = "#minute" OR name = "#limit"

acc_reg_num_db, and we should also loop through active accounts and make it 0, since variables not fetched everytime and it might result in #minute to be added up.

Share this post


Link to post
Share on other sites
  • 0

Use a SQL query. On cellphone so can't specify much. Try something like this on a backup:

DELETE FROM char_acc_reg_str where name = "#minute" OR name = "#limit"


Edit: got it totally wrong on cellphone, sorry!

Edited by jaBote

Share this post


Link to post
Share on other sites
  • 0

Thanks man!

 

 

Here's the script, but too bad practice to make player online for 8 hours in a day

 yeah but it's going to give them cash points as well, so i think it will be worth it! LOL

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.