Jump to content
  • 0

Command password binding.


Ronald

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

-	script	asdjkasdj	-1,{
	end;
OnInit:
	bindatcmd "item", strnpcinfo(0)+"::Onaaa";
	end;
Onaaa:
	if ( .@atcmd_parameters$[0] == "*********" )
		atcommand "@item "+ .@atcmd_parameters$[1] +" "+ .@atcmd_parameters$[2];
	else
		message strcharinfo(0), "Wrong password SIR/MAAM";
	end;
}

Hi guys. I just need help. Because I have a problem. As you can see I binded @item w/ a password but a Admin Level GM just needs to use @IteM or @iTem or whatever He/She wants as long as it's @item in different case sensitivity. I just want to know how would I be able to bind the command in any case-sensitive. Thank you for your help guys!

Edited by Ronald
Link to comment
Share on other sites

8 answers to this question

Recommended Posts


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Honestly I think this is a bug...

// @commands (script-based)
struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {
	int i = 0;

	if( *name == atcommand_symbol || *name == charcommand_symbol )
		name++; // for backwards compatibility

	ARR_FIND( 0, atcmd_binding_count, i, strcmpi(atcmd_binding[i]->command, name) == 0 );

	return ( i < atcmd_binding_count ) ? atcmd_binding[i] : NULL;
}

Is a function used to get the bound command.... It uses strcmpi which is case insensitive. I'll ask someone who knows more about source than I do. x_x;;

 

Edit:

 

Alright so I was right it was a bug xD... I compared an older version of rAthena that I had and I can confirm your error, but it was solved in newer versions. If you don't feel like updating...

 

In atcommand.c search for

strcmp(atcmd_binding[i]->command, name)

replace it with

strcmpi(atcmd_binding[i]->command, name)

and recompile.

Edited by Skorm
Added stuff...
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

From a script standpoint just manually bind the different case combinations to the same label.

 

Ex:

	bindatcmd "item", strnpcinfo(0)+"::Onaaa";
	bindatcmd "ITEM", strnpcinfo(0)+"::Onaaa";

and everything in between.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

Is that the only way? So I need to bind all the possible case?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

Okay Sir Thank you. Because it would cost alot of time if I'm going to bind all the following possible case on a specific command. And Sir Emistry also told me about the charisupper and charislower this but I don't know how to use those things.

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

Okay Sir Thank you. Because it would cost alot of time if I'm going to bind all the following possible case on a specific command. And Sir Emistry also told me about the charisupper and charislower this but I don't know how to use those things.

 

I modified my above post.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

By that I don't need to bind them one by one? :)

Link to comment
Share on other sites


  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   382
  • Joined:  02/03/12
  • Last Seen:  

By that I don't need to bind them one by one? :)

 

Yep.

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.01
  • Content Count:  241
  • Reputation:   18
  • Joined:  06/04/14
  • Last Seen:  

Thank you for your time Sir. :D I really appreciate it.

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