Raised This Month: $ Target: $400
 0% 

Show message to dead people


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alka
AMX Mod X Plugin Approver
Join Date: Dec 2006
Location: malloc(null)
Old 11-16-2007 , 15:07   Re: Show message to dead people
Reply With Quote #1

Nope.
__________________
Still...lovin' . Connor noob! Hello
Alka is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 11-16-2007 , 20:47   Re: Show message to dead people
Reply With Quote #2

is_user_alive() does indeed check whether or not they're connected - why I purposely omitted it when talking about readability is a mystery.

Code:
return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0);

Last edited by Lee; 11-18-2007 at 06:14.
Lee is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-17-2007 , 02:23   Re: Show message to dead people
Reply With Quote #3

Quote:
Originally Posted by Lee View Post
is_user_alive() does indeed check whether or not they're connected - why I purposely omitted it when talking about readability is a mystery.

Code:
return ((pPlayer->ingame && pPlayer->IsAlive()) ? 1 : 0);
In this case, we want to show messages to dead players, so we have to check if players are connected since is_user_alive will return 0 for deads and for non-players.
So what's better ? use is_user_alive and is_user_connected natives or just get_players ?
ConnorMcLeod is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 11-17-2007 , 15:11   Re: Show message to dead people
Reply With Quote #4

Personally, the issue is not which is more efficient - it's about which doesn't degrade readability. Too many people around here (including me at times) are obsessed with pseudo-optimisations.

You're right - in that my usage of is_user_alive() isn't filtering dead players. I negated the following (which would never need is_user_connected()) without thinking.

Code:
if(is_user_alive()) {     doUsefulStuffRatherThanBailing() }
In any case, like many natives, show_hudmessage() checks whether or not they're connected before displaying the message anyway. Because of this a lot of is_user_connected() calls are redundant.

Maybe I should just shut up and stop arguing on both sides of the readability fence.

I think we may have overwhelmed Mrrr somewhat.

Last edited by Lee; 11-18-2007 at 06:25.
Lee is offline
Mrrr
Member
Join Date: Jun 2007
Old 11-27-2007 , 04:04   Re: Show message to dead people
Reply With Quote #5

Thank you for all help.

You are the best !
Mrrr is offline
Reply



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 01:18.


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