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!
![Smile :)](./images/smilies/smile.gif)