Jump to content
  • 0
LeonZ

Rewards system giving error

Question

This error has been occurring, But I couldn't fix someone could help me?

 

//===== rAthena Script ======================================= 
//= WoE Rewards by Mastagoon
//===== Description: =========================================
//= This script rewards players for each minute spent on WoE castle.
//===== Featrures: ===========================================
//= This script rewards players for each minute spent on WoE castle.
//===== Current Version: =====================================
//= 1.0
//===== Featuers: ============================================
//= Can reward players for every minute they spend inside a WoE castle
//= Can reward players for every kill in WoE castle, and will also display the name of the killed/killer.
//= Excludes AFK players and players who are not in a guild.
//= Announces kills with different colors depending on the killer's castle
//= Can set a modifier for certain classes to gain more points than others
//============================================================
function	script	getcharid2	{
	[email protected] = query_sql("select char_id, party_id, guild_id, account_id, clan_id from `char` where name = '"+getarg(1)+"'",[email protected],[email protected],[email protected],[email protected],[email protected]);
	if([email protected] < 0) return 0;
	if(getarg(0)==0) return [email protected];
	else if(getarg(0)==1) return [email protected];
	else if(getarg(0)==2) return [email protected];
	else if(getarg(0)==3) return [email protected];
	else if(getarg(0)==4) return [email protected];
	return 0;
}

-	script	woerewards	-1,{ 

function	AddPlayer	{ //player name , npc name
	for ([email protected] = 0 ; [email protected] < getvariableofnpc(.player_amount,getarg(1)) ; [email protected] += 3)
		if (getvariableofnpc(.players$[[email protected]],getarg(1)) == getarg(0)) return;
	setarray getvariableofnpc(.players$[getvariableofnpc(.player_amount,getarg(1))],getarg(1)) , getarg(0) , strcharinfo(3) , "0";
	set getvariableofnpc(.player_amount,getarg(1)) , getvariableofnpc(.player_amount,getarg(1)) + 3;
	return;
}

OnInit:
	setarray .maps$ ,"schg_cas03", "prtg_cas01"; //maps where the system is active
    .points_per_minute = 1; //number of points earned for each minute you spend in the castle
    for ([email protected] = 0 ; [email protected] < getarraysize(.maps$) ; [email protected]++)
        if (!getmapflag(.maps$[[email protected]],mf_loadevent)) setmapflag .maps$[[email protected]],mf_loadevent;

    .s_idle_time = 180; // time before player is considered idle (in seconds)
    .rewardId = 909;    // ID of the reward item
    .announce = 0;  // Announce kills (0 = no announcement, 1 = map announcement, 2 = global announcement)
    .color_defenders$ = "0xffff00"; // Announcement color when a defending player kills an attacking player
    .color_attackers$ = "0x99ccff"; // Announcement color when an attacking player kills a member of the castle's owner
    .kill_reward = 1;   // Amount of points earned for every kill, set to 0 to disable it
    setarray .class_modifier[0],4063,3,4076,2;  // Modifier for certain classes [Id, Modifier, Id, Modifier....]
	if(agitcheck() || agitcheck2()) initnpctimer;
	end;

OnAgitStart:
	[email protected]$ = "DELETE from `char_reg_num` WHERE `key` = 'woepoints' OR `key` = 'woedeaths' OR `key` = 'woekills' OR `key` = 'woedamage' OR `key` = 'woeempbreak'";
	query_sql([email protected]$);
	addrid(0);
	woepoints = 0;
	detachrid();
	initnpctimer;
	end;

OnPCLoadMapEvent:
	if(!agitcheck() || !getcharid(2)) end;
	for ([email protected] = 0 ; [email protected] < getarraysize(.maps$) ; [email protected]++) {
		if (.maps$[[email protected]] == strcharinfo(3)) {
			if(!woepoints) {
				dispbottom "You've entered a WoE castle map, you will gain rewards for each minute you spend in this castle.";
			}
			AddPlayer(strcharinfo(0),strnpcinfo(0));
		}
	}
	end;

OnTimer10000: //will check every ten seconds if player is still on the map
	freeloop (1);
	for ([email protected] = 0 ; [email protected] < .player_amount ; [email protected] += 3) {
		if (!attachrid(getcharid2(3,.players$[[email protected]]))) { deletearray .players$[[email protected]],3 ; .player_amount -= 3; }
		else if(strcharinfo(3) != .players$[[email protected]+1]) { deletearray .players$[[email protected]],3 ; .player_amount -= 3; }
	}
	for ([email protected] = 0 ; [email protected] < .player_amount ; [email protected] += 3) {
		if(checkidle() < .s_idle_time) {    // no points for idle players
            setarray .players$[[email protected]+2] , ""+(atoi(.players$[[email protected]+2]) + 1)+"";
            if (atoi(.players$[[email protected]+2]) >= 6) {
                if(attachrid(getcharid2(3,.players$[[email protected]]))) {
                    woepoints += .points_per_minute;
                    dispbottom "You've spent one minute in WoE and gained a WoE point."
                    dispbottom "Total points earned: +woepoints;
                    setarray .players$[[email protected]+2] , "0";
                }
            }
        }
	}
	initnpctimer;
	freeloop(0);
	end;

OnPCKillEvent:
	if(!agitcheck() || !getcharid(2) || !.kill_reward) end;
	if(inarray(.maps$,strcharinfo(3)) == -1) end;
	dispbottom "You've recieved "+.kill_reward+" Points for killing "+rid2name(killedrid);
	woepoints += .kill_reward;
    [email protected]$ = getcharid(2) == getcastledata(strcharinfo(3),CD_GUILD_ID) ? .color_defenders$ :  .color_attackers$;
    if(.announce == 1) 
        announce "[WoE]: "+strcharinfo(0)+" Has Killed "+rid2name(killedrid),bc_all,[email protected]$;
    if(.announce == 2)
        mapannounce strcharinfo(3),"[WoE]: "+strcharinfo(0)+" Has Killed "+rid2name(killedrid),bc_map,[email protected]$;
	end;
	
OnPCDieEvent:
	if(!agitcheck() || !getcharid(2)) end;
	if(inarray(.maps$,strcharinfo(3)) == -1) end;
	dispbottom "You've been killed by "+rid2name(killerrid);
	end;

OnPCLogoutEvent:
	if(!agitcheck() && !agitcheck2()) 
		woepoints = 0;
	end;

OnAgitEnd:
	stopnpctimer;
	//participation rewards.
	[email protected]$ = "SELECT `char_id`, `value` FROM `char_reg_num` WHERE `key` = 'woepoints'";
	query_sql([email protected]$,[email protected], [email protected]);
	for([email protected] = 0; [email protected] < getarraysize([email protected]); [email protected]++) {
        [email protected] = inarray(.class_modifier, Class) > -1 ? .class_modifier[inarray(.class_modifier, Class)+1] : 1;
		[email protected] = [email protected][[email protected]];
		[email protected]$ = "[WoE Rewards]";
		[email protected]$ = "Rewards";
		[email protected]$ = "You've recieved a reward for participating in war of emperium.\nTotal Participation Time:";
		setarray [email protected][0],.coinid;
		setarray [email protected][0], [email protected][[email protected]] * [email protected];
		mail [email protected],[email protected]$,[email protected]$,[email protected]$,[email protected],[email protected],[email protected];
	}
	end;

}

 

Sem título.png

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0
6 hours ago, XILeonIX said:

Sem título.png

 

replace this:

dispbottom "You've spent one minute in WoE and gained a WoE point."
dispbottom "Total points earned: +woepoints;

that is why:

dispbottom "You've spent one minute in WoE and gained a WoE point.";
dispbottom "Total points earned: "+woepoints;


 

Edited by Hyroshima
  • Upvote 1
Link to comment
Share on other sites

  • 0
8 hours ago, Hyroshima said:

 

replace this:

dispbottom "You've spent one minute in WoE and gained a WoE point."
dispbottom "Total points earned: +woepoints;

that is why:

dispbottom "You've spent one minute in WoE and gained a WoE point.";
dispbottom "Total points earned: "+woepoints;


 

Thank you very much

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

Important Information

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