Jump to content
sandbox

Utility: Daily Rewards Giver

Recommended Posts

File Name: Daily Rewards Giver

File Submitter: sandbox

File Submitted: 24 Feb 2014

File Category: Utilities

Content Author: sandbox


This script will hand out rewards to your player accounts once upon login, and can be dynamic depending on how you configure it. And when a player logs 5x consecutively, s/he will receive all the prizes from day 1 to 5.

Example based on Day

  1. Red Potion (1pc.)
  2. Orange Potion (2pcs.)
  3. Yellow Potion (3pcs.)
  4. Yggdrasil Berry (2pcs.)
  5. Yggdrasil Seed (1pc.) + 1 Red Potion, 2 Orange Potion, 3 Yellow Potion, 2 Yggdrasil Berry


Terms & Conditions

  • You are not allowed to reproduce or make profit of this script
  • You are not allowed to take credit for this script. Though you can modify/edit it to your liking.
  • I can give you support, but please, do not message me.



Click here to download this file

Link to comment
Share on other sites

i got this error when login to test the daily D:

xlu9lJ4.png

 

ingame

g4dk70i.png

0 null

 

DD:

 

the script D:

//======Name========================================
// Daily Login Rewards
//======Version=====================================
// 1.0
// Author: Sandbox
//======Comments====================================
// 
//==================================================

-	script	DailyLoginRewards	-1,{


setarray [email protected]_Prize[0],673,675,671,12103; //Set to desired item prizes
setarray [email protected]_Amt[0],100,50,10,1; //Amount of prize to be given
set [email protected]_Name$,"Tairyu Ro"; //Set to your server name


OnPCLoginEvent:

	if(gettimetick(2) > #ClaimDelay) {
		if(gettimetick(2) > #StreakDelay) set #LogStreak,0;
		
		if(#RewardStreak == 0) {
			dispbottom "Bienvenido/a a "[email protected]_Name$+"! Recibiste "[email protected]_Amt[#RewardStreak]+" "+getitemname([email protected]_Prize[#RewardStreak])+" por jugar! Entra a jugar diario para recibir regalos como estos! Si te conectas 5 dias consecutivos, recibiras premios extra!";
		}

		else {
			dispbottom "Bienvenido/a a "[email protected]_Name$+"! Recibiste "[email protected]_Amt[#RewardStreak]+" "+getitemname([email protected]_Prize[#RewardStreak])+" por conectarte! Conectate diario para recibir premios! Cuando te conectes 5 dias consecutivos, recibiras premios extra!";
		}

		getitem [email protected]_prize[#RewardStreak],[email protected]_Amt[#RewardStreak];
		set #RewardStreak,#RewardStreak+1;
		set #LogStreak,#LogStreak+1;
		set #ClaimDelay,gettimetick(2)+86400;
		set #StreakDelay,gettimetick(2)+172800;

		if(#LogStreak >= 4) {
			for( set [email protected], 0; [email protected] < 4; set [email protected], [email protected] +1 ) {
				getitem [email protected]_prize[[email protected]],[email protected]_Amt[[email protected]];
			}
			dispbottom "Felicidades!! por conectarse 5 dias consecutivos recibiste varios premios!";
			set #LogStreak,0;
		}

	}
end;
}

i just translated it to spanish D: also changed some ids

Link to comment
Share on other sites

Well, the script never use the variable for the reward, set the variable after onpcloginevent

OnPCLogin....
    setarray [email protected]_Prize[0],673,675,671,12103; //Set to desired item prizes
    setarray [email protected]_Amt[0],100,50,10,1; //Amount of prize to be given
    set [email protected]_Name$,"Tairyu Ro"; //Set to your server name

 

EDIT : Code seems to be broken ??

  • Upvote 1
Link to comment
Share on other sites

Well, the script never use the variable for the reward, set the variable after onpcloginevent

OnPCLogin....

    setarray [email protected]_Prize[0],673,675,671,12103; //Set to desired item prizes

    setarray [email protected]_Amt[0],100,50,10,1; //Amount of prize to be given

    set [email protected]_Name$,"Tairyu Ro"; //Set to your server name

 

EDIT : Code seems to be broken ??

 

hello o: ty for tha repply capuche o:!! huh dunno if it's broken D:!

Link to comment
Share on other sites

Echoing @Capuche, the script is not loading the temporary NPC variables upon login. Here are two different ways to resolve the issue:

  1. Move the OnPCLoginEvent label on line 18 to line 12.
  2. Place an OnInit label on line 12 and an end; on line 16. Then, change all instances of [email protected]_Prize[email protected]_Amt, and [email protected]_Name$ to .D_Prize.D_Amt, and .Serv_Name$, respectively.
  • Upvote 1
Link to comment
Share on other sites

o: i will pick number 1, seems easy (?) thanks o: donna edit when done testing o:!

 

same result with # 1

 

well maybe because i need to @reloadscript or restart (?) because i just did @loadnpc trunk/place/rewardfile.txt D:

Link to comment
Share on other sites

I've fixed it, just follow what Capuche/Missingno did, can't download it yet since uploading a new version would make it unapproved again ;(

Edited by sandbox
Link to comment
Share on other sites

I've fixed it, just follow what Capuche/Missingno did, can't download it yet since uploading a new version would make it unapproved again ;(

 

i did what they say but that not worked D: i just did @loadnpc and not worked then @reloadscript and didn't work so i guess i will need to restart the server

just waiting for the ppl to go to sleep lol

Link to comment
Share on other sites

i did what they say but that not worked D: i just did @loadnpc and not worked then @reloadscript and didn't work so i guess i will need to restart the server

just waiting for the ppl to go to sleep lol

 

Did you unload the previous version prior to loading the new one? And you really shouldn't use @reloadscript on a live server. o_O

Link to comment
Share on other sites

 

i did what they say but that not worked D: i just did @loadnpc and not worked then @reloadscript and didn't work so i guess i will need to restart the server

just waiting for the ppl to go to sleep lol

 

Did you unload the previous version prior to loading the new one? And you really shouldn't use @reloadscript on a live server. o_O

 

 

unloadnpc npcname yeah D:

i do reloadscript on the mornings when every single player is sleeping xD z_z 

 

or i shut it down and then turn it on to live test and see errors on the emulator D:

Link to comment
Share on other sites

unloadnpc npcname yeah D:

i do reloadscript on the mornings when every single player is sleeping xD z_z 

 

or i shut it down and then turn it on to live test and see errors on the emulator D:

 

Are you testing on your GM or with a test account? If you're using your GM or an account that has already received a reward, you won't be able to adequately test until the delay has passed for that account.

 

Honestly, you shouldn't use @reloadscript at all; you'd be better off restarting your server, and even then you shouldn't need to for simply swapping out your NPCs.

 

If you can't see console errors, you should probably be running your server in screen; if you're getting socket errors after running your server in screen, check if other processes are already using those ports (like a second instance of rAthena) and kill them.

Link to comment
Share on other sites

 

unloadnpc npcname yeah D:

i do reloadscript on the mornings when every single player is sleeping xD z_z 

 

or i shut it down and then turn it on to live test and see errors on the emulator D:

 

Are you testing on your GM or with a test account? If you're using your GM or an account that has already received a reward, you won't be able to adequately test until the delay has passed for that account.

 

Honestly, you shouldn't use @reloadscript at all; you'd be better off restarting your server, and even then you shouldn't need to for simply swapping out your NPCs.

 

If you can't see console errors, you should probably be running your server in screen; if you're getting socket errors after running your server in screen, check if other processes are already using those ports (like a second instance of rAthena) and kill them.

 

 

 

aaah thank you o:

 

allright i will take more care of my npcs and server and try to don't use reloadscript at all

 

thanks for the links too o:! going to check o:

Link to comment
Share on other sites

@reloadscript is really not recommended since it also respawns monsters.. You should @unloadnpc it first BEFORE you execute @loadnpc restarting your server is your 2nd option and @reloadscript should be last resort.

Link to comment
Share on other sites

@reloadscript is really not recommended since it also respawns monsters.. You should @unloadnpc it first BEFORE you execute @loadnpc restarting your server is your 2nd option and @reloadscript should be last resort.

 

yeah i know D: that's why i do reloadscript just when there are no players, when they sleep, around 2~4am no one connects

i did the unload and then the load npc 

well np at all im right now having problems with my server so i alrwady did a lot of shutdowns and turns on x_x

 

thankie o:!

Link to comment
Share on other sites

Well, did it work out fine already?

 

i cant see right now, im having problems, give me a while and i will tell you o:

 

offtopic: problems with my server x_x

see general support

 

Edit:

it works :D!

//======Name========================================
// Daily Login Rewards
//======Version=====================================
// 1.0
// Author: Sandbox
//======Comments====================================
// 
//==================================================

-	script	DailyLoginRewards	-1,{

OnPCLoginEvent:

setarray [email protected]_Prize[0],673,675,671,12103; //Set to desired item prizes
setarray [email protected]_Amt[0],100,50,10,1; //Amount of prize to be given
set [email protected]_Name$,"Tairyu Ro"; //Set to your server name



	if(gettimetick(2) > #ClaimDelay) {
		if(gettimetick(2) > #StreakDelay) set #LogStreak,0;
		
		if(#RewardStreak == 0) {
			dispbottom "Bienvenido/a a "[email protected]_Name$+"! Recibiste "[email protected]_Amt[#RewardStreak]+" "+getitemname([email protected]_Prize[#RewardStreak])+" por jugar! Entra a jugar diario para recibir regalos como estos! Si te conectas 5 dias consecutivos, recibiras premios extra!";
		}

		else {
			dispbottom "Bienvenido/a a "[email protected]_Name$+"! Recibiste "[email protected]_Amt[#RewardStreak]+" "+getitemname([email protected]_Prize[#RewardStreak])+" por conectarte! Conectate diario para recibir premios! Cuando te conectes 5 dias consecutivos, recibiras premios extra!";
		}

		getitem [email protected]_prize[#RewardStreak],[email protected]_Amt[#RewardStreak];
		set #RewardStreak,#RewardStreak+1;
		set #LogStreak,#LogStreak+1;
		set #ClaimDelay,gettimetick(2)+86400;
		set #StreakDelay,gettimetick(2)+172800;

		if(#LogStreak >= 4) {
			for( set [email protected], 0; [email protected] < 4; set [email protected], [email protected] +1 ) {
				getitem [email protected]_prize[[email protected]],[email protected]_Amt[[email protected]];
			}
			dispbottom "Felicidades!! por conectarse 5 dias consecutivos recibiste varios premios!";
			set #LogStreak,0;
		}

	}
end;
}

that how is working now o;

  • Upvote 1
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
Reply to this topic...

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

Important Information

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