Raised This Month: $ Target: $400
 0% 

Brekaeable ent.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-25-2009 , 09:05   Brekaeable ent.
Reply With Quote #1

This is just an example from tutorial, 1.how to do breakeble ent and have for example 200health???2.And you can create only 1 ent per round.3.And delete it on round end???.I need an example.
PHP Code:
// fakemeta
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_Classname[] = "func_car"
new g_Model[] = "models/car.mdl"

public plugin_init()
{
    
register_plugin("OMFG","HAX","LOL")
   
    
register_clcmd("say car","CmdSayCar")
   
    
register_forward(FM_Touch,"ForwardTouch")
}

public 
plugin_precache()
    
precache_model(g_Model)

public 
CmdSayCar(id)
{
    new 
Ent engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"info_target"))
    
set_pev(Ent,pev_classname,g_Classname)
    
engfunc(EngFunc_SetModel,Ent,g_Model)
    
set_pev(Ent,pev_solid,SOLID_TRIGGER)
    
engfunc(EngFunc_SetSize,Ent,Float:{-50.0,-50.0,-50.0},Float:{50.0,50.0,50.0})
    
set_pev(Ent,pev_owner,id)
}

public 
ForwardTouch(Ptd,Ptr)
{
    new 
Classname[33],Ent Ptd,id Ptr
    pev
(Ptd,pev_classname,Classname,32)
   
    if(!
equal(Classname,g_Classname))
    {
        
Ent Ptr
        id 
Ptd
       
        pev
(Ptr,pev_classname,Classname,32)
       
        if(!
equal(Classname,g_Classname))
            return
    }
   
    new 
Owner pev(Ent,pev_owner)
    if(
Owner != id)
        return
   
    
client_print(id,print_chat,"You have used this car. Due to time purposes, I'm not going to add code beyond this.")


Last edited by xbatista; 02-25-2009 at 09:08.
xbatista is offline
Send a message via Skype™ to xbatista
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-25-2009 , 09:14   Re: Brekaeable ent.
Reply With Quote #2

set him pev_health to 200.0 and you will get breakable, about one per round, you can use global variable for that
__________________
xPaw is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-25-2009 , 09:24   Re: Brekaeable ent.
Reply With Quote #3

Set_pev health for ent?
Quote:
about one per round, you can use global variable for that
How to do this?
Example please ;)

Last edited by xbatista; 02-25-2009 at 09:35.
xbatista is offline
Send a message via Skype™ to xbatista
Dr.G
Senior Member
Join Date: Nov 2008
Old 02-25-2009 , 11:03   Re: Brekaeable ent.
Reply With Quote #4

set_pev(Ent, pev_health, 200)... and your classname should be func_breakable
__________________
Dr.G is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-25-2009 , 11:10   Re: Brekaeable ent.
Reply With Quote #5

Dr.G it doesnt effect afaik
__________________
xPaw is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-25-2009 , 11:16   Re: Brekaeable ent.
Reply With Quote #6

You should also set pev_takedamage

Quote:
Originally Posted by hlsdk_const.inc
// new Float:takedamage, pev(entity, pev_takedamage, takedamage) values
#define DAMAGE_NO 0.0
#define DAMAGE_YES 1.0
#define DAMAGE_AIM 2.0
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-25-2009 , 11:18   Re: Brekaeable ent.
Reply With Quote #7

So I must do this?
set_pev(entity, pev_health, 200)
set_pev(entity, pev_takedamage, 1.0) ??
Quote:
2.And you can create only 1 ent per round.3.And delete/remove it on round end???
And how about this?

Last edited by xbatista; 02-25-2009 at 11:22.
xbatista is offline
Send a message via Skype™ to xbatista
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 02-25-2009 , 11:23   Re: Brekaeable ent.
Reply With Quote #8

set_pev(entity, pev_takedamage, DAMAGE_YES) would be better (for clarity).

You may have to spawn the entity, dunno.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-25-2009 , 11:27   Re: Brekaeable ent.
Reply With Quote #9

Thx to all.
xbatista is offline
Send a message via Skype™ to xbatista
xbatista
Veteran Member
Join Date: Mar 2008
Location: Lithuania
Old 02-25-2009 , 15:00   Re: Brekaeable ent.
Reply With Quote #10

And the last question ;) How to create a sprite effect of killed wall?
PHP Code:
#include <amxmodx>
#include <fakemeta>

#define PLUGIN "XxX"
#define AUTHOR "xbatista"
#define VERSION "0.1"
 
new g_Classname1[] = "wall_brekeable"
new WallModel[] = "models/wall.mdl"

public plugin_precache()
{
    
precache_model(WallModel)
}
public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd("+wall""wall"
    
    
register_forward(FM_Touch,"ForwardTouch")
}
public 
wall(id

    new 
went engfunc(EngFunc_CreateNamedEntity,engfunc(EngFunc_AllocString,"func_wall")) 
    new 
Float:flOrigin[3]
    new 
aVector[3]
    
get_user_origin(idaVector3)
    
IVecFVec(aVectorflOrigin)
    
set_pev(wentpev_originflOrigin)
    
    
set_pev(went,pev_classname,g_Classname1
    
engfunc(EngFunc_SetModelwentWallModel
    
set_pev(went,pev_solid,SOLID_BBOX
    
set_pev(wentpev_health200.0)
    
set_pev(wentpev_takedamageDAMAGE_YES)
    
engfunc(EngFunc_SetSizewentFloat:{-5.0, -90.0, -150.0}, Float:{5.090.0150.0}) 


public 
ForwardTouch(Ptd,Ptr

    if(!
pev_valid(Ptd))
            return 
FMRES_IGNORED;
    
    new 
Classname[33]
    
pev(Ptd,pev_classname,Classname,32
    
    if(!
equal(Classname,g_Classname1)) 
            return 
FMRES_IGNORED;

    return 
FMRES_IGNORED;

xbatista is offline
Send a message via Skype™ to xbatista
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 16:55.


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