Raised This Month: $13 Target: $400
 3% 

Bomb Status [ V 1.7 ]


Post New Thread Reply   
 
Thread Tools Display Modes
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-01-2014 , 12:17   Re: Bomb Status
Reply With Quote #11

Quote:
Originally Posted by ArabicMan View Post
It will make lag you can make cvar that control of that i can make it permanently or every x sec i think it will be better.
What's the point of your post?
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-01-2014 , 12:23   Re: Bomb Status
Reply With Quote #12

Quote:
Originally Posted by Backstabnoob View Post
  • PHP Code:
    set_task 0.1 "ShowHud" id 
  • Why? You're displaying the message for 12 seconds. There's absolutely no reason to reshow it every 0.1 seconds. Also it will look really silly with director hud messages, because they have no channels and they will just overlap one over another so after those 12 seconds you'll have a big nice block of color if the content of the message changes a lot.
  • Also, cache the hud sync objects.
  • In GetName, check if the user is connected to the server. You don't even have to use this, just remove it entirely and get the name directly in the HUD function, just cache the bomb ent ID.
  • Also, instead of copying the contents of dhudmessage.inc, just leave it in the includes and point to it in your thread in case it gets updated or something.

I didn't look thoroughly but that's what you should start with if you want this to get approved.
1. I need to update it every 0.1 second, in order to catch immediately every change ( bomb dropped,planted etc ). But I can't make the hud to stay only for 0.1 seconds, it will cause a awful bug. I think that it should remain like this.
2. Will be added.
3. I'll add the check and when I have time will remove GetName.
4. Some peoples are lazy, if the plugin can't be directly compiled they won't use it.
5. Some peoples wanted it to be with dhud, so I maked a cvar. It will remain as it is.

ArabicMan I really don't see the reason to do this.

Last edited by HamletEagle; 06-01-2014 at 12:31.
HamletEagle is offline
ArabicMan
Veteran Member
Join Date: Feb 2014
Location: مصر
Old 06-01-2014 , 12:29   Re: Bomb Status
Reply With Quote #13

Quote:
Originally Posted by Backstabnoob View Post
What's the point of your post?
I want to control message with cvar like what i said "Message appear permanently or every x sec"
the point that i manage to control this. (Sorry for my bad english)

Last edited by ArabicMan; 06-01-2014 at 12:29.
ArabicMan is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 06-01-2014 , 12:34   Re: Bomb Status
Reply With Quote #14

Quote:
Originally Posted by HamletEagle View Post
1. I need to update it every 0.1 second, in order to catch immediately every change ( bomb dropped,planted etc ). But I can't make the hud to stay only for 0.1 seconds, it will cause a awful bug. I think that it should remain like this.
Then decrease the amount of time you hold the message. 0.1 seconds is not needed, every 1 second would be better

Quote:
4. Some peoples are lazy, if the plugin can't be directly compiled they won't use it.
Poor excuse.
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (intervening in a thread, asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-01-2014 , 12:46   Re: Bomb Status
Reply With Quote #15

Quote:
Originally Posted by YamiKaitou View Post
Then decrease the amount of time you hold the message. 0.1 seconds is not needed, every 1 second would be better


Poor excuse.
Wrong, 1.0 it's not ok,but I decreased the amount of time the hud is hold. It's not an excuse, adding a link to a file will not make my life better or not, but this is the truth, peopels are lazy.

When I finish all this changes I'll release a new version. Thanks all of you for this advices.

Last edited by HamletEagle; 06-02-2014 at 12:14.
HamletEagle is offline
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-01-2014 , 12:55   Re: Bomb Status
Reply With Quote #16

As for that "terrible bug" you're talking about, you most likely mean flickering (which will happen with dhud). The solution to that is simple - reshow the message each second and set the holdtime to 1.1 seconds.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
DonKisgot
Senior Member
Join Date: Dec 2010
Old 06-01-2014 , 14:37   Re: Bomb Status
Reply With Quote #17

Super Useful Suggestion (I want credit for this awesome suggestion ) ;

Bomb Status For EVERYONE WHO İS DEAD or SPECTATING ?

will you do this please ? I want CT's can see if they are DEAD
DonKisgot is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-02-2014 , 12:44   Re: Bomb Status
Reply With Quote #18

UPDATE TO 0.5

All changes suggested by Backstabnoob are now done. I firstly want to make the actual code "perfect", after this I'm going to add another stuffs.

Last edited by HamletEagle; 06-02-2014 at 12:44.
HamletEagle is offline
Adventx
Member
Join Date: Feb 2014
Location: Romania
Old 06-04-2014 , 11:56   Re: Bomb Status
Reply With Quote #19

good job, it's a genial idea!
Nice, thaks! ;)
Adventx is offline
Send a message via Yahoo to Adventx
Backstabnoob
Veteran Member
Join Date: Feb 2009
Location: Iwotadai Dorm
Old 06-04-2014 , 12:47   Re: Bomb Status
Reply With Quote #20

More thoroughly:

You should properly prefix your variables. If you have these as globals: new g_iTeam, BombPlanted, iStatus, hud_type, g_fBombSitesOrigins then it makes your code really confusing. Stick to one style.

PHP Code:
g_iBombSites], Floatg_fBombSitesOrigins][ ], Floatg_fBombOrigins
Why 3? I don't know if there can be more than two bomb sites, but you never work with the first cells anyway. You just put everything into 1 and 2 instead of 0 and 1.

PHP Code:
if ( ! MapHasBombSites )
    return; 
Just pause the plugin if the map doesn't have bombsites.

PHP Code:
new iEntities 
iEntities ] =  engfunc(EngFunc_FindEntityByString, -"classname""func_bomb_target")     
iEntities ] =  engfunc(EngFunc_FindEntityByString,-"classname""info_bomb_target"
First off, this won't even work at all because iEntities[ 1 ] and iEntities[ 2 ] will have the same entity index because you start from -1 in both cases.

Also, this step is completely useless because you do it here anyway:
PHP Code:
if ( IsMapSwapped ) {
    
g_iBombSites ] = find_ent_by_class ( -"func_bomb_target" )
    
g_iBombSites ] = find_ent_by_class g_iBombSites ] , "func_bomb_target" )    
}
else {    
    
g_iBombSites ] = find_ent_by_class ( -"func_bomb_target" )
    
g_iBombSites ] = find_ent_by_class g_iBombSites ] , "func_bomb_target" )

PHP Code:
if ( ! Bomb || ! g_iBombSites ] && ! g_iBombSites ]  ) //if we are here,we should have a valid bomb,but let's check again
    
return ; 
Completely remove this and pause the plugin if there are no bombsites as I said earlier.

PHP Code:
public client_putinserver id 
    if ( 
MapHasBombSites set_task 3.0 "ShowHud"id )

public 
client_disconnect id )
    
remove_task id 
Remove this completely. Initialize the ShowHud task at plugin_init and loop through all players in the ShowHud function.

PHP Code:
if ( BombPlanted )  
    
formatex HudMessagesizeof HudMessage ) -"Bomb Planted :%s^nBombSite: %s^nStatus:Planted^nPlanter:%s^nDistante To Bomb: %i",BombPlanted == "Yes" "No",iValue == "A" :"B"szPlanterNamefloatround get_distance_f (PlayerOriginsg_fBombOrigins) / 100 ) )
    
if ( !
BombPlanted ) {
    if ( 
iStatus == )
        
formatex HudMessagesizeof HudMessage ) -"Bomb Planted :%s^nBombSite: No^nStatus:%s ^nCarrier:No^nDistante To Bomb: No",BombPlanted == "Yes" "No",iStatus == "Dropped" "Carried" )
    else
        
formatex HudMessagesizeof HudMessage ) -"Bomb Planted :%s^nBombSite: No^nStatus:%s^nCarrier:%s^nDistante To Bomb:No",BombPlanted == "Yes" "No",iStatus == "Dropped" "Carried" ,szName1)        

Instead of another if( ) just do an else statement, that's what it's for.
Also, you check for iStatus and BombPlanted in the formatex( ) native even though you already know what these are.


PHP Code:
set_task 0.1 "ShowHud" id )
set_hudmessage(0255850.00.1506.05.0
Again, this is wrong. As I said earlier, just do set_task( 1.0, "ShowHud", .flags = "b" ) in plugin_init. 0.1 seconds is AN OVERKILL. Also you probably didn't read what we said earlier, but change the holdtime (5.0) to 1.1.

PHP Code:
id1 EntOwner 
You don't need this, just work with EntOwner directly. Also, why do you have szName1 and szPlanterName? You can just cache both of these into one string.
__________________
Currently busy working on a very large scale anime database project.
Backstabnoob is offline
Old 06-04-2014, 14:52
HamletEagle
This message has been deleted by HamletEagle.
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 12:31.


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