Half-Life и Adrenaline Gamer форум
http://aghl.ru/forum/

Spawn Mine Protection + Server crash fix.
http://aghl.ru/forum/viewtopic.php?f=20&t=705
Страница 3 из 4

Автор:  vamp [ 03 июн 2012, 03:43 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

hehe you are getting on to me :D
anyway it is a great module for achieving many handy and fun things.
sadly with this project for the league I can not effort it, maybe in the full version.
on plugins, programming methods, and modules I try to stay as efficient as possible for the players.
maybe there is a paid assignment for either Lev or you Kord for not much maybe 30-50e in the end (couple weeks from now).
to Optimize the source when it is done.
which wont be all that much code neither :)

I really can use some help in efficiency later down the road.
this will be the last thing that im part of, that I co want to give to the hldm AG community.
Ill only play with -arT. for fun sometimes in matches besides that im planning to call in my resignation.
Im over time :D

Автор:  fkk [ 08 июн 2012, 17:52 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

vamp писал(а):
Spawnmine
Is someone able to create a spawn mine protection with amxmodx?
on spawn 2 seconds protection for weapon_tripmine and done.
this way the mine explodes hurting others around it. but not the spawned player.
bringing tripmines back into the game and a new fair dimension of using them on spawnpoint.
greetz vamp

Try this:
Код:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>

new Float:spawntime[33];
new protectiontime;

public plugin_init()
{
    register_plugin("Tripmine spawnmining protection", "0.1", "fkk");

    RegisterHam(Ham_Spawn, "player", "fw_spawn_player", 1);
    RegisterHam(Ham_TakeDamage, "player", "fw_takedamage_player", 0);

    protectiontime = register_cvar("tripmine_protection_time", "2");
}

public fw_spawn_player(id)
{
    spawntime[id] = get_gametime();
}

public fw_takedamage_player(victim, inflictor, attacker, Float:damage, bits)
{
    if (is_user_alive(victim)) {
        new ent_name[32];
        entity_get_string(inflictor, EV_SZ_classname, ent_name, 32);
        if((equali(ent_name, "monster_tripmine")) && ((get_gametime() - spawntime[victim]) < get_pcvar_float(protectiontime)))
        {
            return HAM_SUPERCEDE;
        }
    }
    return HAM_IGNORED;
}

Keep in mind that this is my first attempt at writing code for amx so there might be some bugs, but I've tested it for a few days and everything seems alright. Cheers! :)

Автор:  Lev [ 08 июн 2012, 18:05 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

Good job!

Автор:  vamp [ 16 июл 2013, 16:04 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

vamp писал(а):
Изображение

Код:
#include <hl.inc>

public plugin_init()
   register_plugin("Crash fix", "1.0", "Lev")
   
public client_command(plrid)
{
   // Get client command.
   new cmd[5], arg[32];
   read_argv(0, cmd, sizeof(cmd) - 1);
   read_argv(1, arg, sizeof(arg) - 1);
   // Check if command is drop.
   if (equali(cmd, "drop"))
   {
      // Block direct crowbar dropping.
      if (equali(arg, "weapon_crowbar"))
         return PLUGIN_HANDLED;
      // Block if crowbar is a current weapon.
      new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));
      if (wepid == HLW_CROWBAR)
         return PLUGIN_HANDLED;
   }
   return PLUGIN_CONTINUE;
}

can anyone create this plugin that blocks dropping your crowbar with fakemeta or engine ?

Автор:  Lev [ 16 июл 2013, 16:51 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

There is no real difference which module you will use.
In fakemeta you can use get_pdata_int in place of get_pdata_cbase in HAM.
Код:
#define EXTRAOFFSET      5
#define EXTRAOFFSET_WEAPONS   4
#define OFFSET_WEAPONID      30
#define OFFSET_ACTIVEITEM   306
stock hl_get_user_weapon_ent(client)
{
   return get_pdata_cbase(client, OFFSET_ACTIVEITEM, EXTRAOFFSET)
}
stock hl_get_weapon_id(entity)
{
   return get_pdata_int(entity, OFFSET_WEAPONID, EXTRAOFFSET_WEAPONS)
}


   new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));

So you just need this code. Replace get_pdata_cbase with get_pdata_int. If I am not wrong, it should work.

Автор:  vamp [ 16 июл 2013, 22:16 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

thanks for the fast response!
I will test after dinner.

Автор:  vamp [ 19 июл 2013, 04:14 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

Изображение

Код:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <hl>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Lev"

#define EXTRAOFFSET      5
#define EXTRAOFFSET_WEAPONS   4
#define OFFSET_WEAPONID      30
#define OFFSET_ACTIVEITEM   306


stock hl_get_user_weapon_ent(client)
{
   return get_pdata_int(client, OFFSET_ACTIVEITEM, EXTRAOFFSET)
}
stock hl_get_weapon_id(entity)
{
   return get_pdata_int(entity, OFFSET_WEAPONID, EXTRAOFFSET_WEAPONS)
}

   new wepid = hl_get_weapon_id(hl_get_user_weapon_ent(plrid));

Автор:  Lev [ 19 июл 2013, 11:10 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

Oo
Did you just compile this? This is not a plugin. This is a sample code. You have to use it correctly.
hl.inc is not needed if you implement these functions in plugin.

Автор:  vamp [ 19 июл 2013, 12:11 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

figured you would give me something as much :P

Автор:  Lev [ 19 июл 2013, 14:05 ]
Заголовок сообщения:  Re: Spawn Mine Protection + Server crash fix.

No, I gave least needed.

Страница 3 из 4 Часовой пояс: UTC + 5 часов [ Летнее время ]
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/