AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   AddToFullPack exchange? (https://forums.alliedmods.net/showthread.php?t=270778)

BeNq! 08-29-2015 09:12

AddToFullPack exchange?
 
Hello,

My code is:
Code:

/* Class generated by AMXX STUDIO */

#include <amxmodx>
#include <fakemeta>

public plugin_init() {
        register_plugin("Visible mine", "1.0", "benq");
       
        register_forward(FM_AddToFullPack, "FwdAddToFullPack", 1)
}

public FwdAddToFullPack(es_handle, e, ent, host, hostflags, player, pSet){
        if(!is_user_connected(host))
                return;

        if(!pev_valid(ent))
                return;
       
        new classname[5];
        pev(ent, pev_classname, classname, 4);
        if(equal(classname, "mine"))
        {
                set_es(es_handle, ES_RenderMode, kRenderTransAdd);
                set_es(es_handle, ES_RenderAmt, 255.0);
        }
}

and I tested the profiler. The result was shocking:
Code:

date: Sat Aug 29 13:11:25 2015 map: de_dust2
type |                            name |      calls | time / min / max
-------------------------------------------------------------------
  n |                  register_plugin |          1 | 0.000000 / 0.000000 / 0.000000
  n |                register_forward |          1 | 0.000001 / 0.000001 / 0.000001
  n |                is_user_connected |  97695176 | 53.584341 / 0.000000 / 0.006235
  n |                        pev_valid |    3027522 | 1.853765 / 0.000000 / 0.000815
  n |                              pev |    2287037 | 1.426752 / 0.000000 / 0.000842
  n |                            equal |    2287037 | 1.262358 / 0.000000 / 0.000790
  n |                          set_es |      18190 | 0.011435 / 0.000000 / 0.000085
  n |                        read_data |        981 | 0.000544 / 0.000000 / 0.000007
  p |                FwdAddToFullPack |  97685575 | 116.755105 / 0.000000 / 0.006407
  p |                      plugin_init |          1 | 0.000005 / 0.000005 / 0.000005

Is there any other function that the player could see the mines invisible?
Sorry, my english is weak...

BeNq! 08-30-2015 15:19

Re: AddToFullPack exchange?
 
Help please.

SpeeDeeR 08-30-2015 20:47

Re: AddToFullPack exchange?
 
Use it on spawn or whenever you like.
I'm not sure if set_user_rendering would work the same way.
PHP Code:

stock fm_set_rendering(entityfx kRenderFxNone255255255render kRenderNormalamount 16) {
    new 
Float:RenderColor[3];
    
RenderColor[0] = float(r);
    
RenderColor[1] = float(g);
    
RenderColor[2] = float(b);

    
set_pev(entitypev_renderfxfx);
    
set_pev(entitypev_rendercolorRenderColor);
    
set_pev(entitypev_rendermoderender);
    
set_pev(entitypev_renderamtfloat(amount));

    return 
1;



HamletEagle 08-31-2015 02:06

Re: AddToFullPack exchange?
 
set_user_rendering works in the same way as fm_set_rendering, but it seems you cannot use it on non player entities(it does a check with CHECK_PLAYER which basically check if player is between 1 and MaxClients)

BeNq! 08-31-2015 06:42

Re: AddToFullPack exchange?
 
I'm working with amxx plugin for the Call of Duty modification for CS 1.6 server and I have a question about one class.
The first class has invisibility and the second class can see that first guy.
For now I'm using AddToFullPack function for the second guy to see the first oneinvisible player but it's really hard on the processor usage, it simply executes too many times...
Is there any other function I could use for that kind of check with better optimalization, not so resource heavy?

NiHiLaNTh 08-31-2015 06:55

Re: AddToFullPack exchange?
 
I am not sure, but pev_groupinfo might help.

Depresie 08-31-2015 15:10

Re: AddToFullPack exchange?
 
seriously? using prethink like functions for setting the rendering of an entity ?

why dont you set the rendering of the entity when it is spawned? ( in the main plugin )

also, use the stock above for rendering

BeNq! 08-31-2015 18:35

Re: AddToFullPack exchange?
 
An example?

NiHiLaNTh 09-01-2015 04:04

Re: AddToFullPack exchange?
 
set_user_rendering for player entities, fm_set_rendering for non-player entities.

BeNq! 09-01-2015 16:50

Re: AddToFullPack exchange?
 
You dont understand at all the code above...

"The first class has invisibility and the second class can see that first guy."
So the player has to see invisible player ( e.g. class Ninja ) or mine.....


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

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