Hi,
the following code doesn't work, but i can't discover why.
PHP Code:
public FakeMetaTouch(iEnt, id)
{
if(!pev_valid(iEnt) || !(1 <= id <= 32))
return FMRES_IGNORED
static Ent[32], ClassePlayer[32]; new Float:origin[3];
pev(iEnt, pev_classname, Ent, 31);
pev(id, pev_classname, ClassePlayer, 31);
pev(iEnt, pev_origin, origin);
if(equali(Ent, "Presente") && equali(ClassePlayer, "player")) // This one works
{
if(is_user_alive(id))
{
ColorChat(id, GREEN, "[Tag Here] ^3Voce tocou no presente e ganhou 5 XP");
ColorChat(0, GREEN, "Alguem pegou o presente");
PlayerXP[id] += 5;
engfunc(EngFunc_RemoveEntity, iEnt);
}
}
else if(equali(Ent, "grenade") && equali(ClassePlayer, "player")) // The problem begins here, it never execute
{
new Dono = pev(iEnt, pev_owner)
if(is_user_alive(Dono) && is_user_alive(id))
{
if(cs_get_user_team(Dono) != cs_get_user_team(id))
{
ColorChat(0, GREEN, "Someone touched");
ExecuteHamB(Ham_Killed, id, Dono, 1);
}
}
}
else if(equali(Ent, "grenade")) // It doesn't work too
{
ColorChat(0, GREEN, "Touched something, but not a player");
}
ColorChat(0, GREEN, "Classe iEnt: %s, Classe Player: %s", Ent, ClassePlayer); // It never shows "grenade"
return FMRES_IGNORED;
}
More information:
What i want to do is something like the "Snowball war", when the grenade touches another player it kills him. I Tried to look in the source code of that plugin, but with no success;
You can find the plugin here (SnowBall War)
https://forums.alliedmods.net/showthread.php?p=735477
In the ColorChat messages, it never showed "grenade" or something like this, but it showed the "Presente" classname and also showed "weaponbox" when i took a weapon;
It compiles fine, no errors and no warnings;
"Presente" is an Entity that i created in another part of the plugin (Presente = gift).
I Also tried with Ham_Touch and register_touch
Thanks.