R>2nd atcommand symbol

Masao

Retired Staff
Messages
49
Points
0
Emulator
Hercules
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

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

 
From atcommand.c

Code:
	// 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:
Code:
// @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)
Code:
// @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;}
 
Last edited by a moderator:
It should be 

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

 
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

 
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?

 
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.

 
Back
Top