AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   New Plugin Submissions (https://forums.alliedmods.net/forumdisplay.php?f=26)
-   -   Bomb Status [ V 1.7 ] (https://forums.alliedmods.net/showthread.php?t=241320)

Backstabnoob 06-01-2014 12:17

Re: Bomb Status
 
Quote:

Originally Posted by ArabicMan (Post 2145368)
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?

HamletEagle 06-01-2014 12:23

Re: Bomb Status
 
Quote:

Originally Posted by Backstabnoob (Post 2145365)
  • 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.

ArabicMan 06-01-2014 12:29

Re: Bomb Status
 
Quote:

Originally Posted by Backstabnoob (Post 2145370)
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)

YamiKaitou 06-01-2014 12:34

Re: Bomb Status
 
Quote:

Originally Posted by HamletEagle (Post 2145375)
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.

HamletEagle 06-01-2014 12:46

Re: Bomb Status
 
Quote:

Originally Posted by YamiKaitou (Post 2145383)
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.

Backstabnoob 06-01-2014 12:55

Re: Bomb Status
 
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.

DonKisgot 06-01-2014 14:37

Re: Bomb Status
 
Super Useful Suggestion (I want credit for this awesome suggestion :D ) ;

Bomb Status For EVERYONE WHO İS DEAD or SPECTATING ?

will you do this please ? I want CT's can see if they are DEAD :)

HamletEagle 06-02-2014 12:44

Re: Bomb Status
 
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.

Adventx 06-04-2014 11:56

Re: Bomb Status
 
good job, it's a genial idea!
Nice, thaks! ;)

Backstabnoob 06-04-2014 12:47

Re: Bomb Status
 
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.


All times are GMT -4. The time now is 12:47.

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