Raised This Month: $213 Target: $400
 53% 

Disconnect Reason


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-22-2020 , 19:47   Re: Disconnect Reason
Reply With Quote #101

Try
PHP Code:
trimmessage );
client_print_color(Player,print_team_red,"%s Disconnected [%s]",Name, !strlenmessage ) ? "N\A" message); 
__________________
Bugsy is offline
666
Senior Member
Join Date: Mar 2015
Old 01-24-2020 , 10:53   Re: Disconnect Reason
Reply With Quote #102

Quote:
Originally Posted by Bugsy View Post
Try
PHP Code:
trimmessage );
client_print_color(Player,print_team_red,"%s Disconnected [%s]",Name, !strlenmessage ) ? "N\A" message); 
the message remains the same, sometimes it appears like this
PHP Code:
666 Disconnected [, ]
666 Disconnected [  ] 
__________________
666 is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-24-2020 , 14:37   Re: Disconnect Reason
Reply With Quote #103

Try
PHP Code:
(!message[0]) 
instead of
PHP Code:
!strlenmessage 
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-24-2020 , 15:11   Re: Disconnect Reason
Reply With Quote #104

That was tried in my above code when checking if the first cell in the string is EOS, since EOS==0.

I think the problem is when there is not a cancel reason sent by the game there is no string sent at all so when you try to access the first cell you get a memory access error. I will take a look later.
__________________
Bugsy is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-24-2020 , 16:50   Re: Disconnect Reason
Reply With Quote #105

You forgot to close up your condition which probably only checked if EOS is true instead of if value equals EOS.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-24-2020 , 16:59   Re: Disconnect Reason
Reply With Quote #106

For the single condition parentheses would not matter for the ternary condition to return appropriately.

PHP Code:
message] == EOS "N\A" message 
__________________

Last edited by Bugsy; 01-24-2020 at 19:03.
Bugsy is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-25-2020 , 11:49   Re: Disconnect Reason
Reply With Quote #107

Are you sure? I remember having issues because of a situation like this.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 01-25-2020 , 12:55   Re: Disconnect Reason
Reply With Quote #108

Quote:
Originally Posted by georgik57 View Post
Are you sure? I remember having issues because of a situation like this.
Yup, try it. Parenthesis are not required for a condition to be treated as a condition, the compiler is smart enough to know. If you have multiple conditions and need to group some together, then parenthesis are required. I usually will use parenthesis regardless because I think it's cleaner and helps with readability.
PHP Code:
new szTest];
server_print"Did this %s" szTest] == EOS "work" "not work" ); 
Output: "Did this work"

because szTest[ 0 ] == EOS is true. EOS equals 0 so if your thought was correct, it would have said 'not work'.
__________________

Last edited by Bugsy; 01-25-2020 at 13:05.
Bugsy is offline
georgik57
Veteran Member
Join Date: Oct 2008
Location: 🎧Music World
Old 01-25-2020 , 13:30   Re: Disconnect Reason
Reply With Quote #109

Ait thanks for clearing that out for me.
__________________
georgik57 is offline
Send a message via MSN to georgik57 Send a message via Yahoo to georgik57 Send a message via Skype™ to georgik57
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 16:17.


Powered by vBulletin®
Copyright ©2000 - 2020, vBulletin Solutions, Inc.
Theme made by Freecode