Jump to content
  • 0

Variable reset at 00h and IP cooldown


Question

Posted (edited)

 
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

10 answers to this question

Recommended Posts

Posted

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

Posted

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

Posted

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 ?
Posted (edited)

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
Posted

@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

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...