Jump to content
  • 0
hardelite

Problem with the prize at the event

Question

Hello community friends, how are you ?a

Please, I wish someone could help me with the prize for this event.
Due to the event's award being in points loaded directly into the 'login' and 'guild' tables this generates a huge delay on my server.

The award works as follows:
Whoever destroys the monsters will receive 100 cashpoints and 100 wotpoints. And the rest of the clan players who manage to survive the event will receive 50 wotpoints.

And I would like to change it. But I have no idea how I do it.

Is it possible, instead of adding points, to add item? for example:
Whoever destroys the mafia will win 100 PoringCoin (7539)
And the rest of the clan that survives on the map will win 50 PoringCoin?

Script:

Spoiler
	monster "prt_are_in",178,87,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	monster "prt_are_in",126,139,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	stopnpctimer;

	OnMobDeath:
	set .@GID,getcharid(0);
	set .@NAME,getcharid(2);
	set .@ACC,getcharid(3);
	
	query_sql "UPDATE `char` SET `baus` = `baus` +1 WHERE `char_id`="+.@GID+"";
	query_sql "UPDATE `login` SET `wotpoints` = `wotpoints` +100 WHERE `account_id`="+.@ACC+"";
	announce "[Wot] The player ["+strcharinfo(0)+"] of the clan ["+getguildName(.@NAME)+"] just destroyed one of the chests!",8;
	atcommand "@cash 100";

	set .@GUILD,getcharid(2);
	query_sql "UPDATE `guild` SET `baus` = `baus` +1 WHERE `guild_id`="+.@GUILD+"";
	query_sql "UPDATE `guild` SET `pontosgwot` = `pontosgwot` +50 WHERE `guild_id`="+.@GUILD+"";
	end;
}

 

Honestly, thank you very much!

Edited by hardelite
Link to comment
Share on other sites

6 answers to this question

Recommended Posts

  • 0
24 minutes ago, hardelite said:

Hello community friends, how are you ?a

Please, I wish someone could help me with the prize for this event.
Due to the event's award being in points loaded directly into the 'login' and 'guild' tables this generates a huge delay on my server.

The award works as follows:
Whoever destroys the monsters will receive 100 cashpoints and 100 wotpoints. And the rest of the clan players who manage to survive the event will receive 50 wotpoints.

And I would like to change it. But I have no idea how I do it.

Is it possible, instead of adding points, to add item? for example:
Whoever destroys the mafia will win 100 PoringCoin (7539)
And the rest of the clan that survives on the map will win 50 PoringCoin?

Script:

  Hide contents

	monster "prt_are_in",178,87,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	monster "prt_are_in",126,139,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	stopnpctimer;

	OnMobDeath:
	set .@GID,getcharid(0);
	set .@NAME,getcharid(2);
	set .@ACC,getcharid(3);
	
	query_sql "UPDATE `char` SET `baus` = `baus` +1 WHERE `char_id`="+.@GID+"";
	query_sql "UPDATE `login` SET `wotpoints` = `wotpoints` +100 WHERE `account_id`="+.@ACC+"";
	announce "[Wot] The player ["+strcharinfo(0)+"] of the clan ["+getguildName(.@NAME)+"] just destroyed one of the chests!",8;
	atcommand "@cash 100";

	set .@GUILD,getcharid(2);
	query_sql "UPDATE `guild` SET `baus` = `baus` +1 WHERE `guild_id`="+.@GUILD+"";
	query_sql "UPDATE `guild` SET `pontosgwot` = `pontosgwot` +50 WHERE `guild_id`="+.@GUILD+"";
	end;
}

 

Honestly, thank you very much!

Hey, I think is it:

Spoiler
	monster "prt_are_in",178,87,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	monster "prt_are_in",126,139,"Treasure chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
	stopnpctimer;

	OnMobDeath:
	/*
	set [email protected],getcharid(0);
	set [email protected],getcharid(2);
	set [email protected],getcharid(3);

	query_sql "UPDATE `char` SET `baus` = `baus` +1 WHERE `char_id`="[email protected]+"";
	query_sql "UPDATE `login` SET `wotpoints` = `wotpoints` +100 WHERE `account_id`="[email protected]+"";
	announce "[Wot] The player ["+strcharinfo(0)+"] of the clan ["+getguildName([email protected])+"] just destroyed one of the chests!",8;
	atcommand "@cash 100";

	set [email protected],getcharid(2);
	query_sql "UPDATE `guild` SET `baus` = `baus` +1 WHERE `guild_id`="[email protected]+"";
	query_sql "UPDATE `guild` SET `pontosgwot` = `pontosgwot` +50 WHERE `guild_id`="[email protected]+"";
	end;
	*/

	set .@account_id, getcharid(3);
	set .@guild_id, getcharid(2);

	deletearray .@guild_arr[0];
	getguildmember .@guild_id, 2, .@guild_arr;

	announce "[Wot] The player ["+strcharinfo(0)+"] of the clan ["+getguildname(.@guild_id)+"] just destroyed one of the chests!",8;
	getitem 7539, 100;

	for(.@i = 0; .@i < getarraysize(.@guild_arr); .@i++)
	{
		if (.@guild_arr[.@i] != .@account_id)
		{
			if (isloggedin(.@guild_arr[.@i]) == true)
			{
				if (attachrid(.@guild_arr[.@i]) == true)
				{
					if (strcharinfo(3) == "prt_are_in" && Hp > 0)
					{
						getitem 7539, 50;
					}

					detachrid;
				}
			}
		}
	}

	end;
}

 

  • Love 1
Link to comment
Share on other sites

  • 0
51 minutes ago, hardelite said:

Thank you Master @Cretino
It works perfectly.

Just a question about the warning on the map-server.

Is this warning normal?

Sem-t-tulo.png

No, this one is because you trying to use the command 'getcharid(3)' without rid attached.

What you are trying to do?
Show the full script.

Edited by Cretino
Link to comment
Share on other sites

  • 0

Mr. @Cretino,
Script
:
 

Spoiler
prontera,147,174,5	script	War of Treasure	4_TREASURE_BOX,{

set @npc$,"[^008000War of Treasure^000000]";                                      

	mes @npc$;
	mes "Hello, "+strcharinfo(0)+"!";
	mes	"Welcome to the portal of the War of Treasure event.";
	mes "What do you want?";
	switch(select("- Enter the event:- Info:- Ranking:Close"))
	{
		case 1:
		next;
		if(!getcharid(2)){
		mes @npc$;
		mes "Sorry, you must be a member of a clan to participate ...";
		close;
				}
		if($woton == 0){
		mes @npc$;
		mes "The event is closed. Come back later...";
		close;
				}
		warp "prt_are_in",97,25;end;

		case 2:
		next;
		mes @npc$;
		mes "The Treasury War will require a lot of bravery and companionship.";
		next;
		mes @npc$;
		mes "The event takes place every day every 4 hours.";
		next;
		mes @npc$;
		mes "After the event starts, your clan will need to survive 10 minutes of combat with other clans.";
		next;
		mes @npc$;
		mes "If your clan manages to survive, 2 treasure chests will appear containing special prizes for those who destroy them.";
		next;
		mes @npc$;
		mes	"And Poring Coins for other clan players who survive the event, which when accumulated can be exchanged for prizes.";
		close;

		case 3:
		next;
		mes "[Ranking WOT]";
		query_sql "SELECT `name`, `baus` FROM `guild` WHERE '"+getcharid(2)+"' ORDER BY `Baus` DESC LIMIT 10",@nom$,@bau;
		mes @np$;
		mes "Position - ^228B22Guild^000000 - ^00B2EEChests^000000";
		for (set .@i,0; .@i < 10; set .@i, .@i + 1)
		mes (.@i+1)+"º^000000 - ^228B22"+@nom$[.@i]+"^000000 - ^00B2EE"+@bau[.@i]+"^000000";
		close;
		
		case 4:
		close;
	}

OnClock2125: callsub ComecarWot;
OnClock0400: callsub ComecarWot;
OnClock0800: callsub ComecarWot;
OnClock1200: callsub ComecarWot;
OnClock1600: callsub ComecarWot;
OnClock2335: callsub ComecarWot;

ComecarWot:
		announce "[War of Treasure] It will start in 5 minutes.",8;
		killmonsterall "prt_are_in";
		removemapflag "prt_are_in",mf_noskill;
		initnpctimer;
		set $woton,1;
		end;
OnTimer60000:
		Announce "[War of Treasure] It will start in 4 minutes.",8;
		end;
OnTimer120000:
		Announce "[War of Treasure] It will start in 3 minutes.",8;
		end;
OnTimer180000:
		Announce "[War of Treasure] It will start in 2 minutes.",8;
		end;
OnTimer240000:
		Announce "[War of Treasure] It will start in 1 minutes.",8;
		end;
OnTimer300000:
		gvgon "prt_are_in";
		announce "[War of Treasure] Started!",8;
		set $woton,0;
		end;

OnTimer900000:
		stopnpctimer;
		setmapflag "prt_are_in",mf_noskill;
		gvgoff "prt_are_in";
		if (getmapusers("prt_are_in") == 0 ){
		end;
				}
		mapannounce "prt_are_in","There are 10 seconds left for the chests to appear.",8;
		sleep 10000;
		monster "prt_are_in",178,87,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
		monster "prt_are_in",126,139,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";

OnMobDeath:
	set .@account_id, getcharid(3);
	set .@guild_id, getcharid(2);

	deletearray .@guild_arr[0];
	getguildmember .@guild_id, 2, .@guild_arr;

	announce "[War of Treasure]: The player ["+strcharinfo(0)+"] of the clan ["+getguildname(.@guild_id)+"] destroyed one of the chests!",8;
	getitem 7539, 100;	// Prize for those who destroy the chest.

	for(.@i = 0; .@i < getarraysize(.@guild_arr); .@i++)
	{
		if (.@guild_arr[.@i] != .@account_id)
		{
			if (isloggedin(.@guild_arr[.@i]) == true)
			{
				if (attachrid(.@guild_arr[.@i]) == true)
				{
					if (strcharinfo(3) == "prt_are_in" && Hp > 0)
					{
						getitem 7539, 50;	// Award for the rest of the Guild.
					}

					detachrid;
				}
			}
		}
	}
	end;
}

 

Would this error be because the script is trying to pull a ranking table?

I tried unsuccessfully to add a ranking using the example of another script, in which case this would be: 

https://nopaste.xyz/?4ce66c86678ee8e9#9uYl6pv+zIoW+neWMzZGGBvUhnGJDb1RlHu3qsqCHgw=

But, due to the script pulling the 'login' and 'guild' table, this caused a lot of delay.

I think it would be too complex for me to try to add a ranking.
And maybe it would be better if I remove that ranking.

I would no longer like to abuse your kindness, sir, but how to fix it?

Link to comment
Share on other sites

  • 0
3 hours ago, hardelite said:

Mr. @Cretino,
Script
:
 

  Hide contents

prontera,147,174,5	script	War of Treasure	4_TREASURE_BOX,{

set @npc$,"[^008000War of Treasure^000000]";                                      

	mes @npc$;
	mes "Hello, "+strcharinfo(0)+"!";
	mes	"Welcome to the portal of the War of Treasure event.";
	mes "What do you want?";
	switch(select("- Enter the event:- Info:- Ranking:Close"))
	{
		case 1:
		next;
		if(!getcharid(2)){
		mes @npc$;
		mes "Sorry, you must be a member of a clan to participate ...";
		close;
				}
		if($woton == 0){
		mes @npc$;
		mes "The event is closed. Come back later...";
		close;
				}
		warp "prt_are_in",97,25;end;

		case 2:
		next;
		mes @npc$;
		mes "The Treasury War will require a lot of bravery and companionship.";
		next;
		mes @npc$;
		mes "The event takes place every day every 4 hours.";
		next;
		mes @npc$;
		mes "After the event starts, your clan will need to survive 10 minutes of combat with other clans.";
		next;
		mes @npc$;
		mes "If your clan manages to survive, 2 treasure chests will appear containing special prizes for those who destroy them.";
		next;
		mes @npc$;
		mes	"And Poring Coins for other clan players who survive the event, which when accumulated can be exchanged for prizes.";
		close;

		case 3:
		next;
		mes "[Ranking WOT]";
		query_sql "SELECT `name`, `baus` FROM `guild` WHERE '"+getcharid(2)+"' ORDER BY `Baus` DESC LIMIT 10",@nom$,@bau;
		mes @np$;
		mes "Position - ^228B22Guild^000000 - ^00B2EEChests^000000";
		for (set .@i,0; .@i < 10; set .@i, .@i + 1)
		mes (.@i+1)+"º^000000 - ^228B22"+@nom$[.@i]+"^000000 - ^00B2EE"+@bau[.@i]+"^000000";
		close;
		
		case 4:
		close;
	}

OnClock2125: callsub ComecarWot;
OnClock0400: callsub ComecarWot;
OnClock0800: callsub ComecarWot;
OnClock1200: callsub ComecarWot;
OnClock1600: callsub ComecarWot;
OnClock2335: callsub ComecarWot;

ComecarWot:
		announce "[War of Treasure] It will start in 5 minutes.",8;
		killmonsterall "prt_are_in";
		removemapflag "prt_are_in",mf_noskill;
		initnpctimer;
		set $woton,1;
		end;
OnTimer60000:
		Announce "[War of Treasure] It will start in 4 minutes.",8;
		end;
OnTimer120000:
		Announce "[War of Treasure] It will start in 3 minutes.",8;
		end;
OnTimer180000:
		Announce "[War of Treasure] It will start in 2 minutes.",8;
		end;
OnTimer240000:
		Announce "[War of Treasure] It will start in 1 minutes.",8;
		end;
OnTimer300000:
		gvgon "prt_are_in";
		announce "[War of Treasure] Started!",8;
		set $woton,0;
		end;

OnTimer900000:
		stopnpctimer;
		setmapflag "prt_are_in",mf_noskill;
		gvgoff "prt_are_in";
		if (getmapusers("prt_are_in") == 0 ){
		end;
				}
		mapannounce "prt_are_in","There are 10 seconds left for the chests to appear.",8;
		sleep 10000;
		monster "prt_are_in",178,87,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
		monster "prt_are_in",126,139,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";

OnMobDeath:
	set .@account_id, getcharid(3);
	set .@guild_id, getcharid(2);

	deletearray .@guild_arr[0];
	getguildmember .@guild_id, 2, .@guild_arr;

	announce "[War of Treasure]: The player ["+strcharinfo(0)+"] of the clan ["+getguildname(.@guild_id)+"] destroyed one of the chests!",8;
	getitem 7539, 100;	// Prize for those who destroy the chest.

	for(.@i = 0; .@i < getarraysize(.@guild_arr); .@i++)
	{
		if (.@guild_arr[.@i] != .@account_id)
		{
			if (isloggedin(.@guild_arr[.@i]) == true)
			{
				if (attachrid(.@guild_arr[.@i]) == true)
				{
					if (strcharinfo(3) == "prt_are_in" && Hp > 0)
					{
						getitem 7539, 50;	// Award for the rest of the Guild.
					}

					detachrid;
				}
			}
		}
	}
	end;
}

 

Would this error be because the script is trying to pull a ranking table?

I tried unsuccessfully to add a ranking using the example of another script, in which case this would be: 

https://nopaste.xyz/?4ce66c86678ee8e9#9uYl6pv+zIoW+neWMzZGGBvUhnGJDb1RlHu3qsqCHgw=

But, due to the script pulling the 'login' and 'guild' table, this caused a lot of delay.

I think it would be too complex for me to try to add a ranking.
And maybe it would be better if I remove that ranking.

I would no longer like to abuse your kindness, sir, but how to fix it?

I really don't know why you need this rank, but you can do this:

Spoiler
prontera,147,174,5	script	War of Treasure	4_TREASURE_BOX,{
	set .@npc$,"[^008000War of Treasure^000000]";
	mes .@npc$;
	mes "Hello, "+strcharinfo(0)+"!";
	mes	"Welcome to the portal of the War of Treasure event.";
	mes "What do you want?";
	switch(select("- Enter the event:- Info:- Ranking:Close"))
	{
		case 1:
		next;
		if(!getcharid(2)){
		mes .@npc$;
		mes "Sorry, you must be a member of a clan to participate ...";
		close;
				}
		if($woton == 0){
		mes .@npc$;
		mes "The event is closed. Come back later...";
		close;
				}
		warp "prt_are_in",97,25;end;

		case 2:
		next;
		mes .@npc$;
		mes "The Treasury War will require a lot of bravery and companionship.";
		next;
		mes .@npc$;
		mes "The event takes place every day every 4 hours.";
		next;
		mes .@npc$;
		mes "After the event starts, your clan will need to survive 10 minutes of combat with other clans.";
		next;
		mes .@npc$;
		mes "If your clan manages to survive, 2 treasure chests will appear containing special prizes for those who destroy them.";
		next;
		mes .@npc$;
		mes	"And Poring Coins for other clan players who survive the event, which when accumulated can be exchanged for prizes.";
		close;

		case 3:
		next;
		mes "[Ranking WOT]";
		query_sql "SELECT `name`, `baus` FROM `guild` WHERE '"+getcharid(2)+"' AND `baus` > '0' ORDER BY `baus` DESC LIMIT 10",.@nom$,.@bau;
		mes "Position - ^228B22Guild^000000 - ^00B2EEChests^000000";
		for (set .@i,0; .@i < getarraysize(.@nom$); set .@i, .@i + 1)
		mes (.@i+1)+"º^000000 - ^228B22"+.@nom$[.@i]+"^000000 - ^00B2EE"+.@bau[.@i]+"^000000";
		close;
		
		case 4:
		close;
	}

OnClock2125: callsub ComecarWot;
OnClock0400: callsub ComecarWot;
OnClock0800: callsub ComecarWot;
OnClock1200: callsub ComecarWot;
OnClock1600: callsub ComecarWot;
OnClock2335: callsub ComecarWot;

ComecarWot:
		announce "[War of Treasure] It will start in 5 minutes.",8;
		killmonsterall "prt_are_in";
		removemapflag "prt_are_in",mf_noskill;
		initnpctimer;
		set $woton,1;
		end;
OnTimer60000:
		Announce "[War of Treasure] It will start in 4 minutes.",8;
		end;
OnTimer120000:
		Announce "[War of Treasure] It will start in 3 minutes.",8;
		end;
OnTimer180000:
		Announce "[War of Treasure] It will start in 2 minutes.",8;
		end;
OnTimer240000:
		Announce "[War of Treasure] It will start in 1 minutes.",8;
		end;
OnTimer300000:
		gvgon "prt_are_in";
		announce "[War of Treasure] Started!",8;
		set $woton,0;
		end;

OnTimer900000:
		stopnpctimer;
		setmapflag "prt_are_in",mf_noskill;
		gvgoff "prt_are_in";
		if (getmapusers("prt_are_in") == 0 ){
		end;
				}
		mapannounce "prt_are_in","There are 10 seconds left for the chests to appear.",8;
		sleep 10000;
		monster "prt_are_in",178,87,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";
		monster "prt_are_in",126,139,"Treasure's chest",1324,1,strnpcinfo(0)+"::OnMobDeath";

OnMobDeath:
	// If not player attached end the script. (This can happen if kill the monster with atcommands or player not exists in map-server no more.)
	if (playerattached() == false)
	{
		end;
	}

	set .@account_id, getcharid(3);
	set .@guild_id, getcharid(2);

	deletearray .@guild_arr[0];
	getguildmember .@guild_id, 2, .@guild_arr;

	announce "[War of Treasure]: The player ["+strcharinfo(0)+"] of the clan ["+getguildname(.@guild_id)+"] destroyed one of the chests!",8;
	getitem 7539, 100;	// Prize for those who destroy the chest.

	// Chest count only for who break.
	query_sql "UPDATE `char` SET `baus` = `baus` + '1' WHERE `char_id`= '" + getcharid(0) + "'";

	// Character points.
	query_sql "UPDATE `login` SET `pontoswot` = `pontoswot` + '100' WHERE `account_id` = '" + getcharid(3) + "'";

	// Guild chest count and points.
	query_sql "UPDATE `guild` SET `baus` = `baus` + '1' WHERE `guild_id` = '" + .@guild_id + "'";
	query_sql "UPDATE `guild` SET `pontosgwot` = `pontosgwot` + '50' WHERE `guild_id` = '" + .@guild_id + "'";

	for(.@i = 0; .@i < getarraysize(.@guild_arr); .@i++)
	{
		if (.@guild_arr[.@i] != .@account_id)
		{
			if (isloggedin(.@guild_arr[.@i]) == true)
			{
				if (attachrid(.@guild_arr[.@i]) == true)
				{
					if (strcharinfo(3) == "prt_are_in" && Hp > 0)
					{
						getitem 7539, 50;	// Award for the rest of the Guild.

						// Give 50 points to other guild players.
						query_sql "UPDATE `login` SET `pontoswot` = `pontoswot` + '50' WHERE `account_id` = '" + getcharid(3) + "'";
					}

					detachrid;
				}
			}
		}
	}
	end;
}

prontera,154,196,5	script	Ranking WOT	837,{
	mes "[Ranking WOT]";
	mes "Olá "+strcharinfo(0)+" qual ranking da wot deseja visualizar?";

	switch(select("- Ranking Jogadores:- Ranking Clãs"))
	{
		case 1:
			next;
			mes "[Ranking WOT]";
			query_sql "SELECT `name`, `baus` FROM `char` WHERE '"+getcharid(0)+"' AND `baus` > '0' ORDER BY `baus` DESC LIMIT 10",.@nome$,.@baus;
			mes "Posição - ^228B22Nome^000000 - ^00B2EEBaus^000000";
	
			for (set .@i,0; .@i < getarraysize(.@nome$); set .@i, .@i + 1)
				mes (.@i+1)+"º^000000 - ^228B22"+.@nome$[.@i]+"^000000 - ^00B2EE"+.@baus[.@i]+"^000000";
		break;

		case 2:
			next;
			mes "[Ranking WOT]";
			query_sql "SELECT `name`, `baus` FROM `guild` WHERE '"+getcharid(2)+"' AND `baus` > '0' ORDER BY `baus` DESC LIMIT 10",.@nom$,.@bau;
			mes "Posição - ^228B22Clã^000000 - ^00B2EEBaus^000000";

			for (set .@i,0; .@i < getarraysize(.@nom$); set .@i, .@i + 1)
				mes (.@i+1)+"º^000000 - ^228B22"+.@nom$[.@i]+"^000000 - ^00B2EE"+.@bau[.@i]+"^000000";
		break;
	}

	close;
}

 

To solve the 'delay' problem getting the rank information you'll need create one table and make the changes in the script to 'save' and 'load' the 'points' there, so when you access the new table not will have so many 'characters' or 'guilds' to 'search'. I made some changes, but I think your 'delay' problem not will change.

I hope it's help you. 🙂

 

Edited by Cretino
  • Love 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
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.