Jump to content
  • 0

Need help with script


Serken

Question


  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   3
  • Joined:  10/06/13
  • Last Seen:  

I have this script

 

 


	set .@size, query_sql( "select nombre from asesinoss where exp > 10 order by exp desc limit "+ .top, .@nombre$);
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@nombre$[.@c] +"^000000 ";
message .@nombre$[.@1],"Alguien os busca";
message .@nombre$[.@2],"Alguien os busca";

close;

OnInit: // Script Configuration
	set .a, 1; // 
	set .top, 10; //
	end;

}

 

it works, take a rank of table "asesinoss" with order, but when i want to send a message to all 10 of rank, the message only send to the first of rank, anyone can help me please? thanks!

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  37
  • Reputation:   3
  • Joined:  02/14/14
  • Last Seen:  

5 hours ago, Serken said:

I have this script

 

 



	set .@size, query_sql( "select nombre from asesinoss where exp > 10 order by exp desc limit "+ .top, .@nombre$);
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@nombre$[.@c] +"^000000 ";
message .@nombre$[.@1],"Alguien os busca";
message .@nombre$[.@2],"Alguien os busca";

close;

OnInit: // Script Configuration
	set .a, 1; // 
	set .top, 10; //
	end;

}

 

it works, take a rank of table "asesinoss" with order, but when i want to send a message to all 10 of rank, the message only send to the first of rank, anyone can help me please? thanks!

for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
	mes .@nombre$[.@i];  //CODE HERE
}

 

Edited by Tisuuu
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  40
  • Reputation:   3
  • Joined:  10/06/13
  • Last Seen:  

8 hours ago, Tisuuu said:

for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
	mes .@nombre$[.@i];  //CODE HERE
}

 

	set .@size, query_sql( "select nombre from asesinoss where exp > 10 order by exp desc limit "+ .top, .@nombre$);
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@nombre$[.@c] +"^000000 ";
		for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
	message .@nombre$[.@i],"Alguien os busca"; 
close;	//CODE HERE
}

OnInit: // Script Configuration
	set .a, 1; // 
	set .top, 10; //
	end;

}

Thanks for reply, i have this but still send message only for the first top of asesinoss, not to all, il try too with

 

mes .@nombre$[.@i];

mes "Someone is searching you";

close;

}


but only appear a message in the npc, not send to group of "asesinoss" a message

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  5
  • Topics Per Day:  0.00
  • Content Count:  37
  • Reputation:   3
  • Joined:  02/14/14
  • Last Seen:  

1 hour ago, Serken said:

	set .@size, query_sql( "select nombre from asesinoss where exp > 10 order by exp desc limit "+ .top, .@nombre$);
	for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
		mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@nombre$[.@c] +"^000000 ";
		for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
	message .@nombre$[.@i],"Alguien os busca"; 
close;	//CODE HERE
}

OnInit: // Script Configuration
	set .a, 1; // 
	set .top, 10; //
	end;

}

Thanks for reply, i have this but still send message only for the first top of asesinoss, not to all, il try too with

 


mes .@nombre$[.@i];

mes "Someone is searching you";

close;

}


but only appear a message in the npc, not send to group of "asesinoss" a message

The first thing I'm going to say is always leave your code correctly identified:

for (set .@c, 0; .@c < .@size; set .@c, .@c + 1)
	mes "Top ^FF0000" +(.@c + 1) +"^000000 ^0000FF" + .@nombre$[.@c] +"^000000 ";
	for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
		message .@nombre$[.@i],"Alguien os busca"; 
		close;	//CODE HERE
	}

Notice the code above, it has 2 repeating structure doing the same thing.

Another thing, if you want to show all players within a replay structure you need to let it run smoothly, In the code above inside the repeating structure we see the command "Close;", this causes the code to stop the first time it runs.

An effective way to show this result in a conversation with npc would be like this:

set .@size, query_sql( "select nombre from asesinoss where exp > 10 order by exp desc limit "+ .top, .@nombre$);

for(.@i = 0; .@i < getarraysize(.@size); .@i++) {
	mes "Top ^FF0000" +(.@i + 1) +"^000000 ^0000FF" + .@nombre$[.@i] +"^000000 "; 
}
close;	
                                        
OnInit: // Script Configuration
	set .a, 1; // 
	set .top, 10; //
	end;
}

Notice that "Close;" got out of the repeating structure...

Now if you want each player to receive the message you need to set an event for it, in which case the message only appears in a conversation with npc.

 

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