Jump to content
  • 0
Sign in to follow this  
Masao

R>2nd atcommand symbol

Question

Hi everyone,

 

I'd like to ask if anyone could help me in giving me an diff or an very good guide in how to add an second atcommand symbol to the source, so players on my server can use @ and ! to make commands work, for ex.:

 

@go 0 will sind them to prontera

!go 0 will also send them to prontera

 

So both commands work the exact same way just with an different symbol.

 

Thanks in advance to anyone who can help me.

 

Regards

Masao

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts

  • 0

From atcommand.c

	// Command symbols	if (config_lookup_string(&atcommand_config, "atcommand_symbol", &symbol)) {		if (ISPRINT(*symbol) && // no control characters			*symbol != '/' && // symbol of client commands			*symbol != '%' && // symbol of party chat			*symbol != '$' && // symbol of guild chat			*symbol != atcommand->char_symbol)			atcommand->at_symbol = *symbol;	}
Lookup for all instances of atcommand->at_symbol and add a OR clause as needed. Ex:
// @commands (script-based)struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {	int i = 0;	if( *name == atcommand->at_symbol || *name == atcommand->char_symbol )		name++; // for backwards compatibility	ARR_FIND( 0, atcommand->binding_count, i, strcmp(atcommand->binding[i]->command, name) == 0 );	return ( i < atcommand->binding_count ) ? atcommand->binding[i] : NULL;}
Replace with: (Not quite sure if you can simply add the check as string, I think you should though)
// @commands (script-based)struct atcmd_binding_data* get_atcommandbind_byname(const char* name) {	int i = 0;	if( *name == atcommand->at_symbol || *name == atcommand->char_symbol || *name == "!" )		name++; // for backwards compatibility	ARR_FIND( 0, atcommand->binding_count, i, strcmp(atcommand->binding[i]->command, name) == 0 );	return ( i < atcommand->binding_count ) ? atcommand->binding[i] : NULL;}
Edited by Xgear

Share this post


Link to post
Share on other sites
  • 0

guide-wise I think if you ctrl+f all places the '@' thing is check, just adding another check for your new symbol should work

Share this post


Link to post
Share on other sites
  • 0

It should be 

 

*name == '!'

"!" denotes a string, which is a char array ended with '0' (null) character.

Share this post


Link to post
Share on other sites
  • 0

Im allready using a second @command symbol in my server but atm i got the problem when i use bindatcmd script , the script dont work with my second atcommand symbol. Allready looked at the script.c where the bindatcmd is stored but not sure how to add it there.

 

Any help would be nice

Share this post


Link to post
Share on other sites
  • 0

It should be 

 

*name == '!'

"!" denotes a string, which is a char array ended with '0' (null) character.

 

Didn't know there was a difference between double and single quotes. Thanks for pointing that out!

 

@ ossi

Have you tried doing what I and Gepard said in BUILDIN(bindatcmd) @ script.c and struct atcmd_binding_data* get_atcommandbind_byname @ atcommand.c?

Do you get any errors?

Share this post


Link to post
Share on other sites
  • 0

Thanks for the replies, I tried what you said but unfortunatly it didn' work :-/

 

If anyone could provide an .patch or .diff file that's working I'd appreaciate it very much.

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.