set_speak in fakemeta...

Questions, on how to perform AMXX scripting, are inside of this forum.
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

set_speak in fakemeta...

Post by Archive-Poster »

Possible?

I'm in the process of finishing up my last batch of plugins that I'm converting over to fakemeta and can't seem to find how to change set_speak.

Any tips?
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

Re: set_speak in fakemeta...

Post by Archive-Poster »

I havn't tested the plugin yet but pretty much this is what you have to do in your plugin or make a include to use in your plugin or add that code in your plugin.

Code: Select all

#if !defined _engine_included
#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4

/* set/get a user's speak flags */
native set_speak(iIndex, iSpeakFlags);
native get_speak(iIndex);
#endif

Code: Select all

#include <amxmodx>
#include <fakemeta>

#define SPEAK_NORMAL 0
#define SPEAK_MUTED 1
#define SPEAK_ALL 2
#define SPEAK_LISTENALL 4

new SpeakFlags[33];

public plugin_init()
{
    register_plugin("FM SPEAK", "1.0", "Gaben");

    if(!LibraryExists("engine", LibType_Library))
        register_forward(FM_Voice_SetClientListening, "_FM_Voice_SetClientListening");
}

public plugin_natives()
{
    register_library("SPEAK");

    register_native("set_speak", "_set_speak");
    register_native("get_speak", "_get_speak");
}

public client_disconnect(id)
{
    SpeakFlags[id] = SPEAK_NORMAL;
}

public _set_speak(index, nums)
{
    new id = get_param(1);

    if(!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[SetSpeak] Invalid player %d", id)
        return;
    }

    SpeakFlags[id] = get_param(2);
}

public _get_speak(index, nums)
{
    new id = get_param(1);

    if(!is_user_connected(id))
    {
        log_error(AMX_ERR_NATIVE, "[SetSpeak] Invalid player %d", id)
        return 0;
    }

    return SpeakFlags[id];
}

public _FM_Voice_SetClientListening(iReceiver, iSender, bool:bListen)
{
    if((SpeakFlags[iSender] & SPEAK_MUTED) != 0)
    {
        engfunc(EngFunc_SetClientListening, iReceiver, iSender, false);
        forward_return(FMV_CELL, false);
        return FMRES_SUPERCEDE;
    }

    if((SpeakFlags[iSender] & SPEAK_ALL) != 0)
    {
        engfunc(EngFunc_SetClientListening, iReceiver, iSender, true);
        forward_return(FMV_CELL, true);
        return FMRES_SUPERCEDE;
    }

    if((SpeakFlags[iReceiver] & SPEAK_LISTENALL) != 0)
    {
        engfunc(EngFunc_SetClientListening, iReceiver, iSender, true);
        forward_return(FMV_CELL, true);
        return FMRES_SUPERCEDE;
    }

    forward_return(FMV_CELL, bListen);
    return FMRES_IGNORED;
}
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

Re: set_speak in fakemeta...

Post by Archive-Poster »

Works for the most part.

Now I'm really stuck.

Been using fakemeta_util along with all other fakemeta stocks/funcs.

40+ plugins successfully converted over to fakemeta except for one.

How do I change radius_damage to work with fakemeta.

I'm tired right now and I've been through fakemeta and fakemeta_util includes for the past couple of hours but haven't found anything yet.

If you have any ideas please share. I'm gonna crash for now so hopefully someone knows how to do this.

Thanks.
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

Re: set_speak in fakemeta...

Post by Archive-Poster »

How do I change radius_damage to work with fakemeta
viewtopic.php?t=52
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

Re: set_speak in fakemeta...

Post by Archive-Poster »

lol that code doesnt work... shall i post it here or are u going to fix it yourself?
Actually it does.

Works perfect, like a charm. No errors in compiling and no run time errors from server.

Though I did have to edit it just a bit but yeah.....works fine.

Code: Select all

stock fm_radius_damage(Float:fExplodeAt[3], iDamageMultiplier, iRadiusMultiplier) 
    {
    new ent = 0
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(5 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 10.0 + iDamageMultiplier
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(4 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth 
            pev(ent, pev_health, plHealth)
            
            plHealth - 25.0 + random_num(0, 2 * iDamageMultiplier)
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(3 * iRadiusMultiplier))) > 0) 
        {        
        if (is_user_alive(ent) && !fm_get_user_godmode(ent)) 
            {
            new Float:plHealth
            pev(ent, pev_health, plHealth)
            
            plHealth - 50.0 + random_num(0, 3 * iDamageMultiplier)
            
            if (plHealth < 1) 
                {
                user_kill(ent)
            } 
            else 
                {
                set_pev(ent, pev_health, plHealth)
            }
        }
    }   
    ent = 0
    
    while ((ent = fm_find_ent_in_sphere(ent, fExplodeAt, float(2 * iRadiusMultiplier))) > 0) 
        {
        if (is_user_alive(ent) && !fm_get_user_godmode(ent))
            {
            user_kill(ent)
        }
    }
    
}
User avatar
Archive-Poster
Posts: 1136
Gender:
United States of America

Re: set_speak in fakemeta...

Post by Archive-Poster »

the only problem i found was that random_float().. all params were floats and i was using integers there.
You changed that to random_num() in your code
and i changed all params to float in my code.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest