Jump to content
  • 0

Hourly Points Support


Meister

Question


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Hi I have this script taken from the script request section and my problem is that..

• I don't know how to check the @consecutive hours if it is divisible by 6..

What I want is that.. the server will check @consecutive hours by 6.. if @consecutive hours is divisible by 6 then, no +10 Cash Points will be added. BUT..

For 6 hours of playing = 100 CP

12 hours of playing = 200 CP

18 hours of playing = 300 CP

Now what I've done is a temporary remedy but the problem is even it is @6, or @12, or @18 it still give + 10 CP.

What to do? Thanks!


- 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 == 10) {
dispbottom "The hourly points event stopped because you were idle for 5 minutes. Please relog if you wish to start again.";
stopnpctimer;
end;
}
end;

OnTimer100:
set @minute, @minute + 1;
//Check for 1 Minute
if(@minute == 60){
set @minute,0;
set @consecutive_hour, @consecutive_hour + 1;
if(@consecutive_hour != 24) {
message strcharinfo(0),"You have received 10 Cash Points for playing 1 hour!";
 set #CASHPOINTS,#CASHPOINTS + 10;
 dispbottom "Current Balance: "+#CASHPOINTS+"";
}
}
//Check for every 6 hours..
if(@consecutive_hour == 6 && @consec6 != 1) {
getitem 30090,1;
set #CASHPOINTS,#CASHPOINTS + 100;
announce ""+strcharinfo(0)+" has been awarded with 1 Rainbow Lucky Scroll + additional 100 Cash Points for staying ingame for 6 hours!",0;
dispbottom "Current Balance: "+#CASHPOINTS+"";
set @consec6, @consec6 +1;
}
//Check for every 12 hours..
if(@consecutive_hour == 12 && @consec12 != 1) {
getitem 30090,1;
set #CASHPOINTS,#CASHPOINTS + 200;
announce ""+strcharinfo(0)+" has been awarded with 1 Rainbow Lucky Scroll + addtional 200 Cash Points for staying ingame for 12 hours!",0;
dispbottom "Current Balance: "+#CASHPOINTS+"";
set @consec12, @consec12 +1;
}
//Check for every 18 hours
if(@consecutive_hour == 18 && @consec18 != 1) {
getitem 30090,1;
set #CASHPOINTS,#CASHPOINTS + 300;
announce ""+strcharinfo(0)+" has been awarded with 1 Rainbow Lucky Scroll + additional 300 Cash Points for staying ingame for 18 hours!",0;
dispbottom "Current Balance: "+#CASHPOINTS+"";
set @consec18, @consec18 +1;
}
//Check for 24 hours consecutive
if(@consecutive_hour == 24) {
set @consecutive_hour,0;
getitem 7227,12;
getitem 30090,1;
set #CASHPOINTS,#CASHPOINTS + 500;
announce ""+strcharinfo(0)+" has been awarded with 12 "+getitemname( 7227 )+" + 1 Rainbow Lucky Scroll + 500 Cash Points for staying ingame for 24 hours!",0;
dispbottom "Current Balance: "+#CASHPOINTS+"";
}
stopnpctimer;
initnpctimer;
end;

}

Edited by Emistry
Please use [CODEBOX] or Attachments for long contents.
Link to comment
Share on other sites

3 answers to this question

Recommended Posts


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

Replace

if(@consecutive_hour != 24) {

by

   if(@consecutive_hour != 24 && @consecutive_hour%6 ) {

If @consecutive hours is divisible by 6 then @consecutive_hour%6 equal 0 -->> skip +10 Cash Points.

% - will give you the remainder of the division. 7%2 is equal to 1.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  280
  • Topics Per Day:  0.06
  • Content Count:  841
  • Reputation:   17
  • Joined:  04/16/12
  • Last Seen:  

Replace

if(@consecutive_hour != 24) {

by

if(@consecutive_hour != 24 && @consecutive_hour%6 ) {

If @consecutive hours is divisible by 6 then @consecutive_hour%6 equal 0 -->> skip +10 Cash Points.

% - will give you the remainder of the division. 7%2 is equal to 1.

Didn't understand this line..

If @consecutive hours is divisible by 6 then "@consecutive_hour%6 equal 0" -->> skip +10 Cash Points.

if I put it in the codebox. should it be like?

if(@consecutive_hour != 24 && @consecutive_hour%6 == 0) {

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:  

if I put it in the codebox. should it be like?

if(@consecutive_hour != 24 && @consecutive_hour%6 == 0) {

No this must be

if(@consecutive_hour != 24 && @consecutive_hour%6 ) {

IF statement will work if these conditions are true or positive. That means :

@consecutive_hour

should not be equal to 24 and

@consecutive_hour%6

must be positive. So if @consecutive hours is divisible by 6 the remainder of the division is null so the condition is not satisfied and the player won't gain 10 CashPoints.

It's like you ask isn't it ? >.<

• I don't know how to check the @consecutive hours if it is divisible by 6..

What I want is that.. the server will check @consecutive hours by 6.. if @consecutive hours is divisible by 6 then, no +10 Cash Points will be added. BUT..

Edited by Capuche
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...