Jump to content
  • 0

Determine Character Gender for script.


Question

Posted (edited)

Just a quick question, how can I check the sex of a character if it's offline and in the SQL it's marked as "U" instead of F or M? Is there another way to check a character gender if they are offline? 

TLDR: I need to make a script that can search for a character and determine its info including their sex even if they are offline. 

Edited by Xellyehria

3 answers to this question

Recommended Posts

  • 0
Posted

You can do this in an SQL statement. If it's in an NPC script:

prontera,123,123,5	script	sql_test	123,{
	mes "Input player's char ID";
	input .@charid;
	next;
	query_sql("SELECT `name`, `sex` FROM `char` WHERE `char_id` = '"+ .@charid +" LIMIT 1", .@name$, .@sex$);
	if(getarraysize(.@name$) == 0){
		mes "Unknown Char ID";
	} else {
		mes "Char ID: "+ .@charid;
		mes "Char Name: "+ .@name$[0];
		mes "Char Sex: "+ .@sex$[0];
	}
	close;
}

Untested, but should work.

  • Upvote 1
  • 0
Posted (edited)

Thank you for the response, however as I've mentioned, in the SQL  db sex in the server is usually marked as "U" instead of "M" or "F" for most characters and I am not sure how to convert it. For example this is a female character but when i query for sex with the script you gave as example, it show "U" . 
 Djefn1K.png


 I check in my offline and some character are marked with "F" and "M" but there's also "U".. and in the live server most character has U instead of F or M. So I'm not sure how to determine what is the actual sex of those characters. 

C6swqv8.png

Edited by Xellyehria

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