Jump to content
  • 0

Variable reset at 00h and IP cooldown


HelloKekette

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  09/09/13
  • Last Seen:  

 
prontera,x,y,0 xxx 723,{
 
 
if( #reward == 1 )
{
mes "Reward already collects";
close;
 
}
 
 
if (Weight >= 3*MaxWeight/4) 
{
dispbottom "You need to store some items";
close;
}
 
if(gettime(5)==1)
{
getitem 7539,10;
[color=#ff0000]set ##reward, 1;[/color]
unitskilluseid getcharid(3),698,1;
dispbottom "You collected :";
dispbottom "10 Poring Coin";
close;
}
 
if(gettime(5)==2)
{
getitem 7539,10;
[color=#ff0000]set ##reward, 1;[/color]
unitskilluseid getcharid(3),698,1;
dispbottom "You collected :";
dispbottom "10 Poring Coin";
close;
}
 

[color=#ff0000]OnClock0000:[/color]
[color=#ff0000]reward = 0;[/color]
[color=#ff0000]end;[/color]
 

I want to put a limitation on this npc.

I try the code in red, but dunno if it's correct.. .I would like the timer reset when the server is 00h o'clock.

 

Can you help me ?

Add to this, I want to put a cooldown on ip adress. I want a player to talk to the NPC only once in the day, even if he uses one different account...Thanks !

Edited by HelloKekette
Link to comment
Share on other sites

10 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

change this part

OnClock0000:
reward = 0;
end;

for this 

OnClock0000:
##reward = 0;
end;

and tell me plz if i help you

Edited by Dynasty
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  09/09/13
  • Last Seen:  

I gonna try this.

No idea about check ip ?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

nou... i dont have enough exp to do that

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

it cant be done ...with your way..

the script is required to attach to a player when try to clear the variable since the variable is player based.

 

althought you can try clear it from the SQL  table, but this required all players to logoff before you can do so..

 

otherwise you can refer other daily reward that made in forum...there are plenty of them..

example

http://upaste.me/241f9e

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  09/09/13
  • Last Seen:  

Hello Emistry.

Thanks for the answer.

 

But how can i put a reset of the variable when serv is 00h ? If its hard, i'll goo use 24h delay :)

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

one of the example already shown inside..

prontera,155,181,5	script	Sample	757,{
set .@today,atoi( gettimestr( "%Y%m%d",21 ) );
if( #daily_reward != .@today ){
	set #daily_reward,.@today;
	getitem 512,1;
	getitem 512,2;
	getitem 512,3;
	mes "Gained daily reward.";
}else{
	mes "You already get it.";
}
close;
}

you can also make use of gettime instead of gettimestr

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   0
  • Joined:  09/09/13
  • Last Seen:  

I dont understand this commande...

What means the 21 and %Y%m%d ? Sorry but i'm start on scripting :P

 

But if i try this, is it ok ?

if(gettime(4)==6)
{
##reward = 0;
}
 
The var reward is reset at 00h, ok ?
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

if you want that the var reset at 00h you have to do this:

-	script	resetvar	-1,{
	
	Onclock0000:
		if(##reward >= 1){
			set ##reward,0;
		}else{end;}
	end;
}
Edited by Dynasty
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2348
  • Joined:  10/28/11
  • Last Seen:  

@Dynasty

it cant be done ...with your way..

the script is required to attach to a player when try to clear the variable since the variable is player based.

 

@HelloKkeette

set .@today,gettime(4)
if( #daily_reward != .@today ){
	set #daily_reward,.@today;
	getitem 512,1;
}
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  24
  • Topics Per Day:  0.01
  • Content Count:  151
  • Reputation:   5
  • Joined:  11/09/12
  • Last Seen:  

Sooo, these tipe of script (daily, hourly rewards...) Is better use gettime and gettimestr? Instead of onclock and ontimer?

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