AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Muzzleflash is not work. (https://forums.alliedmods.net/showthread.php?t=335693)

krisztian2 12-25-2021 20:45

Muzzleflash is not work.
 
Dear Scripters!

I have a special problem.

My problem is that, on my local server(windows) this plugin was worked perfectly, but I want to use this plugin on other Counter-Strike 1.6 server(linux server) and this not work.
What is the problem?
In plugin_init:
Code:

register_forward(FM_AddToFullPack, "CPlayer__AddToFullPack_post", 1);
RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "weapon__PrimaryAttack_Post", 1);
g_iEntity = create_entity("info_target");

public CPlayer__AddToFullPack_post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
    if (iEnt != g_iEntity) //This if statement is the problem with Entity.
        return;
.
.
.
.
}
public weapon__PrimaryAttack_Post(iEntity)
{
    new iPlayerID = get_pdata_cbase(iEntity, 41, 4);

    if(get_user_weapon_muzzle(iPlayerID) == true && !cs_get_weapon_silen(iEntity)){
    set_bit(g_bitsMuzzleFlash, iPlayerID);
        }
        else{
        return;
        }
}

Sry for my bad english.

OciXCrom 12-26-2021 07:08

Re: Muzzleflash is not work.
 
What is get_user_weapon_muzzle()?

krisztian2 12-26-2021 12:28

Re: Muzzleflash is not work.
 
It's an include native.
In Main plugin:
Code:

public native_get_user_weapon_muzzle(index)
{
        new fgy[32],iClip,iAmmo;
        fgy[index] = get_user_weapon(index,iClip,iAmmo);
        if(fgy[index] == CSW_AK47 && fgy[index] & iClip != 0){
        if(equali(FegyverAdatok[kivalasztott[index][AK47]][Muzzle],"true"))
        {
                Muzzleflash[index] = true;
                return Muzzleflash[index];
        }
        }


Supremache 12-26-2021 12:50

Re: Muzzleflash is not work.
 
if(equali(FegyverAdatok[kivalasztott[index][AK47]][Muzzle],"true")) ? what this !!!

Try to change this code to
if( FegyverAdatok[kivalasztott[index][AK47]][Muzzle] )

Or show the holy code..

Shadows Adi 12-26-2021 12:57

Re: Muzzleflash is not work.
 
Quote:

Originally Posted by Supremache (Post 2766968)
if(equali(FegyverAdatok[kivalasztott[index][AK47]][Muzzle],"true")) ? what this !!!

Try to change this code to
if( FegyverAdatok[kivalasztott[index][AK47]][Muzzle] )

If it's using equali native, it is a string, otherwise, it won't compile.
http://www.amxmodx.org/api/string/equali

krisztian2 12-26-2021 13:05

Re: Muzzleflash is not work.
 
Well, I try to explain my problem again:
I have a plugin, which can replace muzzleflash from a weapon.(In .qc file I removed the event).
My problem is: In my local server this plugin was perfectly worked.
BUT, If I place this plugin to an other server(which running under linux) this plugin is not work.

Code:

#include <amxmodx>
#include <engine>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

#define PLUGIN_NAME                    "New MuzzleFlash"
#define PLUGIN_VERSION                "Alpha"
#define PLUGIN_AUTHOR                "WPMG Team"

// ?????? ? ??????
#define get_bit(%1,%2)        (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2)        %1 |= (1 << (%2 & 31))
#define reset_bit(%1,%2)    %1 &= ~(1 << (%2 & 31))

new g_bitsMuzzleFlash;

new g_iEntity;

new const spriteok[][] = {
{"sprites/Red/muzzleflash1.spr" },
};

public plugin_precache()
{
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
   
        for(new i=0;i< sizeof(spriteok);i++)
        {
    precache_model(spriteok[i]);
    }
   
}

public plugin_init()
{
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_ak47", "WEAPON__PrimaryAttack_Post", 1);
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_m4a1", "WEAPON__PrimaryAttack_Post", 1);
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_awp", "WEAPON__PrimaryAttack_Post", 1);
    RegisterHam(Ham_Weapon_PrimaryAttack, "weapon_deagle", "WEAPON__PrimaryAttack_Post", 1);
   
    register_forward(FM_AddToFullPack, "CPlayer__AddToFullPack_post", 1);
   
    register_forward(FM_CheckVisibility, "CEntity__CheckVisibility");
        g_iEntity = create_entity("info_target");
       
}

public CEntity__CheckVisibility(iEntity, pSet)
{
    if (iEntity != g_iEntity)
        return FMRES_IGNORED;
   
    forward_return(FMV_CELL, 1);
   
    return FMRES_SUPERCEDE;
}

public WEAPON__PrimaryAttack_Post(iEntity)
{
    new iPlayerID = get_pdata_cbase(iEntity, 41, 4);

    if(!cs_get_weapon_silen(iEntity)){
    set_bit(g_bitsMuzzleFlash, iPlayerID);
        }
        else{
        return;
        }
}

public CPlayer__AddToFullPack_post(esState, iE, iEnt, iHost, iHostFlags, iPlayer, pSet)
{
    if (iEnt != g_iEntity){ //This is my problem on other server. The iEnt not equal with g_iEntity.
        return;
        }
   
    if (get_bit(g_bitsMuzzleFlash, iHost))
    {
        set_es(esState, ES_Frame, float(random_num(0, 2)));
           
        set_es(esState, ES_RenderMode, kRenderTransAdd);
        set_es(esState, ES_RenderAmt, 255.0);
       
        reset_bit(g_bitsMuzzleFlash, iHost);
    }
        new fgy[32];
        fgy[iHost] = get_user_weapon(iHost);
        if(fgy[iHost] == CSW_AK47 || fgy[iHost] == CSW_M4A1 || fgy[iHost] == CSW_AWP || fgy[iHost] == CSW_FAMAS || fgy[iHost] == CSW_M4A1){
    entity_set_model(g_iEntity, spriteok[0]);
        }
        entity_set_float(g_iEntity, EV_FL_scale, 0.2);
    entity_set_int(g_iEntity, EV_INT_rendermode, kRenderTransTexture);
    entity_set_float(g_iEntity, EV_FL_renderamt, 0.0);
    set_es(esState, ES_Skin, iHost);
    set_es(esState, ES_Body, 1);
    set_es(esState, ES_AimEnt, iHost);
    set_es(esState, ES_MoveType, MOVETYPE_FOLLOW);
}


krisztian2 12-26-2021 15:00

Re: Muzzleflash is not work.
 
Problem is solved with this: under the ReHlds this plugin is not work. I don't know why.
iEnt is not equal with g_iEntity in ReHlds.


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

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