Jump to content
  • 0

Determine Character Gender for script.


Xellyehria

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   1
  • Joined:  10/19/16
  • Last Seen:  

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
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3123
  • Reputation:   1617
  • Joined:  03/26/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  22
  • Reputation:   1
  • Joined:  10/19/16
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Forum Manager
  • Topic Count:  282
  • Topics Per Day:  0.06
  • Content Count:  3123
  • Reputation:   1617
  • Joined:  03/26/12
  • Last Seen:  

Are you allowing players to create chars outside of the client? Or are you using a client that doesn't support char-specific genders?

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