AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Smoke plugin bug (https://forums.alliedmods.net/showthread.php?t=343649)

abecee 08-17-2023 16:34

Smoke plugin bug
 
Hi.

I found this plugin on the net, it's functional and what I'm looking for, just that sometimes some people have their smoke disappear and I don't understand why ( it happens randomly without that person doing anything, just playing ).
Could someone help me with fixing this bug if possible?

Thanks in advance.
Code:

#include <amxmodx>
#include <engine>
#include <fakemeta>


public plugin_init() {
    register_plugin("Smoke Thickness", "1.0", "JuSTaR");

    register_cvar("smoke_thickness","3");

    register_forward(FM_PlaybackEvent, "smokeEvent");

}


public smokeEvent(flags, id, eventid, Float:delay, Float:Origin[3], Float:Angles[3], Float:fparam1, Float:fparam2, iparam1, iparam2,bparam1, bparam2)
{
    if((eventid == 26) && (fparam1 == 0.0) && (fparam2 == 0.0) && (iparam2 == 1))
    {
        new smokeEnt = find_ent_by_class(-1,"grenade");

        while(smokeEnt)
        {
            new model[32];
            entity_get_string(smokeEnt, EV_SZ_model, model, 31);


            if(equal(model, "models/w_smokegrenade.mdl"))
            {
                new Float:smoke_origin[3];
                entity_get_vector (smokeEnt, EV_VEC_origin, smoke_origin);

                if((smoke_origin[0] == Origin[0]) && (smoke_origin[0] == Origin[0]) && (smoke_origin[0] == Origin[0]))
                {
                    new Float:angle[3];
                    angle[0] = 0.0;
                    angle[1] = 0.0;
                    angle[2] = 0.0;

                    for (new i = 0; i < get_cvar_num("smoke_thickness"); i++)
                        playback_event(0, smokeEnt, 26, 0.0 , smoke_origin, angle, 0.0, 0.0, 0, 1, 0, 0);
                }
            }

            smokeEnt = find_ent_by_class(smokeEnt,"grenade");
        }
    }

    return FMRES_IGNORED;
}


Kowalsky 08-19-2023 05:21

Re: Smoke plugin bug
 
I am sure you are running a non-steam server, please post us your meta list and version outputs

mlibre 08-19-2023 16:23

Re: Smoke plugin bug
 
Quote:

Originally Posted by Kowalsky (Post 2808858)
I am sure you are running a non-steam server, please post us your meta list and version outputs

what relationship does it have

damage220 08-23-2023 20:03

Re: Smoke plugin bug
 
I may be wrong, but AFAIK the game client can render up to 512 sprites at the same time.
This plugin increases the smoke density by adding additional smokes to the game scene,
therefore when there are multiple smokes on the map, some of them won't be rendered.
Try to decrease smoke density by changing smoke_thickness cvar, say to 2 (now you have 3).
It should help.


All times are GMT -4. The time now is 11:30.

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