Jump to content
  • 0
Sign in to follow this  
Hadeszeus

@unmute player on specific map onLogoutEvent

Question

I can't make this work, should it work right?

 

		OnPCLogoutEvent:		if ( strcharinfo(3) == "guild_vs1" )                atcommand "@unmute "+strcharinfo(0);		end;

 

Or any other way to unmute players on a specific map on logoutevent?

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Yes, you can be creative ending it.

 

According to source:

/*========================================== * @unmute [Valaris] *------------------------------------------*/ACMD(unmute) {	struct map_session_data *pl_sd = NULL;		if (!message || !*message) {		clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>).		return false;	}		if ( (pl_sd = map->nick2sd((char *)message)) == NULL )	{		clif->message(fd, msg_txt(3)); // Character not found.		return false;	}		if(!pl_sd->sc.data[SC_NOCHAT]) {		clif->message(sd->fd,msg_txt(1235)); // Player is not muted.		return false;	}		pl_sd->status.manner = 0;	status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);	clif->message(sd->fd,msg_txt(1236)); // Player unmuted.		return true;}

 

Since I suppose you already know your character is logged in and muted you can skip all the checks and go directly to what you want. Try this instead?

OnPCLogoutEvent:	if (strcharinfo(3) == "guild_vs1" ) {		Manner = 0;		// sc_end SC_NOCHAT; // Edit, not needed as of the documentation says?	}	end;

 

EDIT: You've also got some nice advice on the scripting documentation regarding that on our scripting documentation :P:

 

 

'sc_end' will remove a specified status effect. If SC_All is used (-1), it
will do a complete removal of all statuses (although permanent ones will
re-apply).
 
You can see the full list of status effects caused by skills in
'src/map/status.h' - they are currently not fully documented, but most of
that should be rather obvious.
Note: to use SC_NOCHAT you should alter Manner
Manner = -5; // Will mute a user for 5 minutes
Manner = 0; // Will unmute a user
Manner = 5; // Will unmute a user and prevent the next use of 'Manner'
 
I've just commented out the SC_NOCHAT line. If that doesn't work just edit the script and try with that uncommented again ;)
 
P.S.: You sure you didn't get any warning or so from the console when trying to atcommand? O.o

Share this post


Link to post
Share on other sites
  • 0

 

Yes, you can be creative ending it.

 

According to source:

/*========================================== * @unmute [Valaris] *------------------------------------------*/ACMD(unmute) {	struct map_session_data *pl_sd = NULL;		if (!message || !*message) {		clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>).		return false;	}		if ( (pl_sd = map->nick2sd((char *)message)) == NULL )	{		clif->message(fd, msg_txt(3)); // Character not found.		return false;	}		if(!pl_sd->sc.data[SC_NOCHAT]) {		clif->message(sd->fd,msg_txt(1235)); // Player is not muted.		return false;	}		pl_sd->status.manner = 0;	status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);	clif->message(sd->fd,msg_txt(1236)); // Player unmuted.		return true;}

 

Since I suppose you already know your character is logged in and muted you can skip all the checks and go directly to what you want. Try this instead?

OnPCLogoutEvent:	if (strcharinfo(3) == "guild_vs1" ) {		Manner = 0;		// sc_end SC_NOCHAT; // Edit, not needed as of the documentation says?	}	end;

 

EDIT: You've also got some nice advice on the scripting documentation regarding that on our scripting documentation :P:

 

 

'sc_end' will remove a specified status effect. If SC_All is used (-1), it
will do a complete removal of all statuses (although permanent ones will
re-apply).
 
You can see the full list of status effects caused by skills in
'src/map/status.h' - they are currently not fully documented, but most of
that should be rather obvious.
Note: to use SC_NOCHAT you should alter Manner
Manner = -5; // Will mute a user for 5 minutes
Manner = 0; // Will unmute a user
Manner = 5; // Will unmute a user and prevent the next use of 'Manner'
 
I've just commented out the SC_NOCHAT line. If that doesn't work just edit the script and try with that uncommented again ;)
 
P.S.: You sure you didn't get any warning or so from the console when trying to atcommand? O.o

 

OMG Thank you for that very detailed explanation and fix. Thank you so much Jabote!

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.