Raised This Month: $ Target: $400
 0% 

[Help] FM_Touch - Grenade Touched a player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Brow
Junior Member
Join Date: Dec 2012
Location: São Paulo, Brasil
Old 12-17-2014 , 18:08   [Help] FM_Touch - Grenade Touched a player
Reply With Quote #1

Hi,
the following code doesn't work, but i can't discover why.

PHP Code:
public FakeMetaTouch(iEntid)
{
       if(!
pev_valid(iEnt) || !(<= id <= 32))
             return 
FMRES_IGNORED
 
       
static Ent[32], ClassePlayer[32]; new Float:origin[3];
 
       
pev(iEntpev_classnameEnt31);
       
pev(idpev_classnameClassePlayer31);
       
pev(iEntpev_originorigin);
 
       if(
equali(Ent"Presente") && equali(ClassePlayer"player")) // This one works
       
{
            if(
is_user_alive(id))
            {
                  
ColorChat(idGREEN"[Tag Here] ^3Voce tocou no presente e ganhou 5 XP");
                  
ColorChat(0GREEN"Alguem pegou o presente");
                  
PlayerXP[id] += 5;
 
                  
engfunc(EngFunc_RemoveEntityiEnt);
 
            } 
       }
       else if(
equali(Ent"grenade") && equali(ClassePlayer"player")) // The problem begins here, it never execute
       

             new 
Dono pev(iEntpev_owner)
 
             if(
is_user_alive(Dono) && is_user_alive(id))
             {
                     if(
cs_get_user_team(Dono) != cs_get_user_team(id))
                     {
                            
ColorChat(0GREEN"Someone touched");
 
                            
ExecuteHamB(Ham_KilledidDono1);
                     }
             }
       }
       else if(
equali(Ent"grenade")) // It doesn't work too
       
{
               
ColorChat(0GREEN"Touched something, but not a player");
       }
 
       
ColorChat(0GREEN"Classe iEnt: %s, Classe Player: %s"EntClassePlayer); // 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.

Last edited by Brow; 12-17-2014 at 18:16.
Brow is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viña del Mar, Chile
Old 12-17-2014 , 20:58   Re: [Help] FM_Touch - Grenade Touched a player
Reply With Quote #2

Use register_touch from engine instead of fakemeta's FM_Touch hook.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:26.


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