Jump to content
  • 0

getguildname bug (?)


Question

Posted

Hi, I have the following problem with the getguildname command, at the moment that no member has connected after a reload I get return parameter null

	mes "Guild name "+getguildname(22)+".";
	set .@nb, query_sql("select name from guild where guild_id = 22 limit 1",.@guild_name$);
	if ( .@nb == 0 ) {
		mes "No existe.";
		Close;
	}
	mes "Guild Name "+.@guild_name$+".";
	close;

Image DB

image.png.74b9640b055926a20fc64cefab10a5a9.png

Image script

image.png.fc7d44687197c4b07db0fd6af21ac72e.png

4 answers to this question

Recommended Posts

  • 0
Posted

using the npc script right after create a new guild? 

if yes, then its probably because the server havent obtained the information yet

you can try use the *requestguildinfo(...) to fix/update the info of the newly created guild.

*requestguildinfo <guild id>{,"<event label>"};

This command requests the guild data from the char server and merrily continues
with the execution. Whenever the guild information becomes available (which
happens instantly if the guild information is already in memory, or later, if it
isn't and the map server has to wait for the char server to reply) it will run
the specified event as in a 'donpcevent' call.

 

  • Upvote 1
  • 0
Posted
-	script	sample	-1,{
	
	OnInit:
		// sleep 2000;
		
		.guild_id = 1;
		
		debugmes("====== OnInit (ID = "+.guild_id+") =========");
		debugmes("Guild Name = " + getguildname(.guild_id));
		.@size = query_sql("SELECT name FROM `guild` WHERE `guild_id` = "+.guild_id+" LIMIT 1", .@guild_name$);
		debugmes("Guild Name (SQL) = " + .@guild_name$);
		requestguildinfo .guild_id, strnpcinfo(3)+"::OnRequestInfo";
		end;
		
	OnRequestInfo:
		debugmes("====== OnRequestInfo =========");
		debugmes("Guild Name = " + getguildname(.guild_id));
		.@size = query_sql("SELECT name FROM `guild` WHERE `guild_id` = "+.guild_id+" LIMIT 1", .@guild_name$);
		debugmes("Guild Name (SQL) = " + .@guild_name$);
		end;
}

Output:

[Info]: consolemes: ====== OnInit (ID = 1) =========
[Info]: consolemes: Guild Name = null                <--- It failed
[Info]: consolemes: Guild Name (SQL) = Sleepywood
[Info]: consolemes:
====== OnRequestInfo =========
[Info]: consolemes: Guild Name = Sleepywood          <--- Now it worked.
[Info]: consolemes: Guild Name (SQL) = Sleepywood

 

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