AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Approved Plugins (https://forums.alliedmods.net/forumdisplay.php?f=8)
-   -   [OP4] Monstername (https://forums.alliedmods.net/showthread.php?t=164105)

GordonFreeman (RU) 08-07-2011 11:06

[OP4] Monstername
 
4 Attachment(s)

Description:
Show monster's and players's name with health and armor where player aimning. For Opposing Force Coop.

GordonFreeman (RU) 08-23-2011 00:54

Re: [OP4] Monstername
 
Updated!
Now used only Fakemeta.
Normal name show.
Work correctly now :) (finnaly i get list of all ent in op4)

Arkshine 08-23-2011 05:15

Re: [OP4] Monstername
 
You better use a trie here instead of calling x equals.
Also, make more checks, like entid should be > maxplayers, so it avoids you executes code for nothing..

ConnorMcLeod 05-30-2012 02:31

Re: [OP4] Monstername
 
No changes, consider to use tries and you can submit it again.
Unapproved.

GordonFreeman (RU) 06-01-2012 02:32

Re: [OP4] Monstername
 
ConnorMcLeod, i did. Now using Trie, removed loop. Added playername show.
Why allot of moderators start reviewing plugins? :D

ConnorMcLeod 06-01-2012 02:45

Re: [OP4] Monstername
 
Better than if nobody do anything lol.

I don't think you need to check TrieKeyExists, when TrieGetCell already returns 0 or 1 on same conditions.

GordonFreeman (RU) 06-01-2012 02:57

Re: [OP4] Monstername
 
Quote:

Originally Posted by ConnorMcLeod (Post 1720534)
Better than if nobody do anything lol.

I don't think you need to check TrieKeyExists, when TrieGetCell already returns 0 or 1 on same conditions.

0 for enemies [red hud color]
1 for friends [green hud color]

you think, would be good if

0 if entity not in list [no hud]
1 for enemies [red hud color]
2 for friends [green hud color]

?

ConnorMcLeod 06-01-2012 10:44

Re: [OP4] Monstername
 
Was saying that TrieGetCell returns 0 when the key doesn't exist, not the byref cell value, you do what you want with your plugin features :)

Jozodezokokotar 06-02-2012 12:48

Re: [OP4] Monstername
 
I believe the plugin needs some kind of code "delay" to prevent hud message flickering.
Any ideas how to make this?

Jozodezokokotar 06-02-2012 14:55

Re: [OP4] Monstername
 
I tried this, it works... partially, but still the FM_PlayerPostThink is being called many times per second. Is there a way to optimizing this, please?

code is also a bit modified to show health percentage for monster_apache, don't mind that.

Code:

new pica

public fw_PlayerPostThink(id){
       
        pica ++
        if (pica >= 60 ) {
       
        static ent,bh
        static classname[32],hpinfo[18]
        get_user_aiming(id,ent,bh)
       
        if(!ent)
                return
               
        static health,armor

        if(0<ent<=g_maxplayers){
                return

        }else{
                pica = 0
                pev(ent,pev_classname,classname,31)
               
                if(!TrieKeyExists(g_vodka,classname)||pev(ent,pev_deadflag)!=DEAD_NO)
                        return
                       
                health = pev(ent,pev_health)
                new hratio = procentaPico(health)
               
                TrieGetCell(g_vodka,classname,armor)
               
               
                TrieGetString(g_lolka,classname,classname,31)
               
                formatex(hpinfo,17,"(%d%s)",hratio,"%")

        }
       
        if(health<=0)
                return

        set_hudmessage(206, 24, 0, -1.0, 0.60, 0, 0.0, 2.0, 0.0, 0.2, -1)
        show_hudmessage(id,"%s %s",classname,hpinfo)
        } else {
        return
        }
}

public procentaPico(int) {
        new hratio_tmp = floatround((floatdiv( float(int), float(apachehetloch)) * 100), floatround_ceil )
        return hratio_tmp       
}



All times are GMT -4. The time now is 10:33.

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