Raised This Month: $ Target: $400
 0% 

register touch


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Miko000000
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 02-04-2009 , 09:24   register touch
Reply With Quote #1

Hello i can switch one code and i

ENGINE
Code:
register_touch("player", "land_mine", "mine_touched")

public mine_touched(id, ent)
{
    if(!get_pcvar_num(mines_enabled))
        return
    
    if(!is_user_alive(id))
        return
    
    explode(ent, 0)
}
FAKEMETA (my code)

Code:
register_forward(FM_Touch,"hook_touch")

public hook_touch(id,ent)
    {
    new classname[32]
    pev(id,pev_classname,classname,31)


    if ( equal(classname, "mine_touched")) 
    {
    if(!get_pcvar_num(mines_enabled))
    return FMRES_IGNORED;

    if(!is_user_alive(id))
    return FMRES_IGNORED;

    ent("land_mine", 0)

    return FMRES_IGNORED; 

    }
    return FMRES_IGNORED; 
}
MY code doesn´t work
Miko000000 is offline
Send a message via ICQ to Miko000000 Send a message via Skype™ to Miko000000
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 02-04-2009 , 09:36   Re: register touch
Reply With Quote #2

I'm not good in FM, but i see and can't understand this:

Quote:
ent("land_mine", 0)
Please post all your code.
TheRadiance is offline
Send a message via ICQ to TheRadiance
Miko000000
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 02-04-2009 , 09:37   Re: register touch
Reply With Quote #3

my code have got 4000 lines
Miko000000 is offline
Send a message via ICQ to Miko000000 Send a message via Skype™ to Miko000000
TheRadiance
Senior Member
Join Date: Nov 2007
Location: Kazakhstan
Old 02-04-2009 , 09:40   Re: register touch
Reply With Quote #4

Ok, post "ent("land_mine", 0)" function and tell, what your part of this script must do.
TheRadiance is offline
Send a message via ICQ to TheRadiance
Miko000000
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 02-04-2009 , 09:50   Re: register touch
Reply With Quote #5

sorry it must be explode("land_mine", 0)
Miko000000 is offline
Send a message via ICQ to Miko000000 Send a message via Skype™ to Miko000000
Dr.G
Senior Member
Join Date: Nov 2008
Old 02-04-2009 , 10:37   Re: register touch
Reply With Quote #6

PHP Code:
register_forward(FM_Touch,"hook_touch"
PHP Code:
public hook_touch(ptr,id)
{
 if(
get_pcvar_num(p_enable) && is_user_connected(id) && is_user_alive(id))
 {
  static 
szClassName[32]
  
pev(ptrpev_classnameszClassNamesizeof szClassName 1)
  
  if(!
equal(szClassName"YOUR_CLASSNAME"))
   return 
FMRES_IGNORED
  
// do something, explode function ?????
  
 
}
 return 
FMRES_IGNORED

__________________
Dr.G is offline
Sn!ff3r
Veteran Member
Join Date: Aug 2007
Location: Poland
Old 02-04-2009 , 11:18   Re: register touch
Reply With Quote #7

Quote:
is_user_connected(id) && is_user_alive(id)


Replace with
Code:
is_user_alive(id)
__________________
Join US - custom Zombie Server - Custom Addons:



Sn!ff3r is offline
Send a message via Skype™ to Sn!ff3r
Miko000000
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 02-04-2009 , 11:27   Re: register touch
Reply With Quote #8

I do this

Code:
public hook_touch(ptr,id)
{
    if(get_pcvar_num(p_enable) && is_user_alive(id))
    {
    static szClassName[32]
    pev(ptr, pev_classname, szClassName, sizeof szClassName - 1)
  
    if(!equal(szClassName, "YOUR_CLASSNAME"))
    return FMRES_IGNORED
    
    if(!get_pcvar_num(mines_enabled))
        return
    
    if(!is_user_alive(id))
        return
    
    explode(ent, 0)
    
    }
    return FMRES_IGNORED
}
sorry i dont know what is classname
and there is messange

Code:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Error: Undefined symbol "p_enable" on line 4156
Warning: Function "hook_touch" should return a value on line 4167
Warning: Function "hook_touch" should return a value on line 4170
Error: Undefined symbol "ent" on line 4170
Warning: Expression has no effect on line 4170
Error: Expected token: ";", but found ")" on line 4170
Error: Invalid expression, assumed zero on line 4170
Error: Too many error messages on one line on line 4170

Compilation aborted.
5 Errors.
Could not locate output file C:\pluginy\MZ\hns.amx (compile failed).

Last edited by Miko000000; 02-04-2009 at 11:31.
Miko000000 is offline
Send a message via ICQ to Miko000000 Send a message via Skype™ to Miko000000
Dr.G
Senior Member
Join Date: Nov 2008
Old 02-04-2009 , 11:57   Re: register touch
Reply With Quote #9

p_enabled was i pointer i used, and yours is not p_enabled if i look in your first post thats mines_enabled, and YOUR_CLASSNAME is the class name of your mine. Not YOUR_CLASSNAME unless you used YOUR_CLASSNAME as classname for your mines or what it is...

Quote:
Error: Undefined symbol "ent" on line 4170
Warning: Expression has no effect on line 4170
Error: Expected token: ";", but found ")" on line 4170
Error: Invalid expression, assumed zero on line 4170
Error: Too many error messages on one line on line 4170
That will proberbly mean that u are missing an ) somewhere in line 4170. However i dont think u got the basic knowledge about coding since u post something like that. If u want more help attach your sma here since its 4000 lines +

Cheers!
__________________
Dr.G is offline
Miko000000
Senior Member
Join Date: Jul 2008
Location: Slovakia
Old 02-04-2009 , 12:36   Re: register touch
Reply With Quote #10

yea im 13 y o people and i starting learn pawn and im beginer and i dont understand syntaxs. and I fix it any method and THANX A LOT
Miko000000 is offline
Send a message via ICQ to Miko000000 Send a message via Skype™ to Miko000000
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 01:38.


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