Raised This Month: $51 Target: $400
 12% 

EngineX Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-20-2010 , 07:12   EngineX Functions
Reply With Quote #1

I have made a modified engine module for my block wallhack plugin and made some functions that can be useful for other users!


Message functions:

PHP Code:
// Message functions, read message.inc (the same but more faster than fakemeta)
native message_fbegin(destmsg_typeFloat:origin[3]={0.0,0.0,0.0},player=0);
native emessage_fbegin(destmsg_typeFloat:origin[3]={0.0,0.0,0.0},player=0);

// Message functions, read message.inc (the same but more faster than fakemeta)
native ewrite_fcoord(Float:coord);
native write_fcoord(Float:coord);
native write_fangle(Float:angle);
native ewrite_fangle(Float:angle); 
These work exactly like the normal ones but I made them use the normal types of values.

Advanced functions:
PHP Code:
// Function checks 4 points on a plane made on an entity based on its bounding box (it is like 4 trace lines made to 4 different points calculated by the bounding box!)
// Returns 1 if one point from the borderplane is visible.
// Paramaters:
// startorigin - start point (this is the point where the trace starts!)
// endorigin - end origin, from this origin the plane will be created in right,left,up and down
// mins and maxs - are the bounding box of the target entity, use customs if you like
// ignore - ignore property (see trace line tutorial)
// ignore_ent - ignore entity
// mulconst - this is a multiplication constant, normally the plane has the size of the cube that surronds the entity. If this constant for example 0.5 then the plane is 1/2 times smaller
native is_borderplane_visible(Float:startorigin[3], Float:endorigin[3], Float:mins[3], Float:maxs[3], ignore DONT_IGNORE_MONSTERSignore_ent 0Float:mulconst 1.0);

// The same as is_visible but checks origin not an entity
native is_visible_origin(entityFloat:origin[3]);

// Returns 1 if origin is in front of the entity, 0 if not
native in_front(entity, const Float:origin[3]);

// The same as fakemeta trace texture but works better, it is more efficient, and it also does not crash the server
// Return 1 when we have a valid texture, 0 when not.
native trace_texture(entityFloat:v1[3], Float:v2[3], texture[], len); 
Examples:
PHP Code:
// This will check if an entity is in front of our player/other ent (it can work with any ents!)
stock is_ent_in_front(ident)
{
    new 
Float:origin[3];
    
entity_get_vector(entEV_VEC_originorigin);
    return 
in_front(idorigin);
}

// This will print the texture and the texture type to the player that sees a view ent! (does not work with players)
stock trace_viewent_texture(id)
{
    new 
Float:start[3], Float:end[3], Float:angles[3];
    
entity_get_vector(idEV_VEC_originstart);
    
entity_get_vector(idEV_VEC_view_ofsend);
    
    
// We get the start origin! It is the player eyes!
    
xs_vec_add(endstartstart);

    
// We  get the direction where the player is aiming (here we have angles! Not a directional vector!)
    
entity_get_vector(idEV_VEC_v_angleangles);
    
// We transform the angle vector in a directional vector, we choose FORWARD because we want to trace in front of the player! (Where he is aiming)
    
angle_vector(anglesANGLEVECTOR_FORWARDangles);
    
    
// We make the vector very big! Because the vector that we obtained after transforming is too small to have any results!
    
xs_vec_mul_scalar(angles10000.0angles);

    
// We obtain the end origin, which is the place where the player is aiming
    
xs_vec_add(startanglesend);
    
    
// Get the entity that we hit!
    // Here we loose the angles but it is not a problem! We use it as an end
    
new pHit trace_line(idstartendangles);
    
    
// Here we substract the vectors to obtain the difference between them (if they are equal our trace hasn't hit anything)
    
new Float:dif[3], Float:dif2[3];
    
xs_vec_sub(startenddif);
    
xs_vec_sub(startanglesdif2);
    
    
// We compare the lengths, here is like comparing TR_flFraction with 1.0
    
if (xs_vec_len(dif) == xs_vec_len(dif2))
    {
        
client_print(idprint_chat"No Entity Has been hit!");
        return 
0;
    }
    
    
// Apply entity correction, because pHit is -1 when the traceline hits the worldspawn!
    
if (pHit 0)
        
pHit 0;
    
    new 
texture[64];
    
    
// If trace_texture returns 1 we have a valid texture!!!
    
if (trace_texture(pHitstartendtexturecharsmax(texture))
    {
        
// to see the type values check my tut about EngFunc_TraceTexture!
        
new type dllfunc(DLLFunc_PM_FindTextureTypetexture);
        
client_print(idprint_chat"Texture name: %s, Texture type: %c"texturetype);
        return 
type;
    }
    else
    {
        
client_print(idprint_chat"Texture name: %s, Texture type: No Texture"texture);
        return 
0;
    }
    
    
    return 
0;

Border plane stock example!
PHP Code:
stock is_player_border_visible(idtarget)
{
    new 
Float:mins[3], Float:maxs[3], Float:start[3], Float:end[3];
    
entity_get_vector(idEV_VEC_originstart);
    
entity_get_vector(idEV_VEC_view_ofsend);
    
    
// We obtain, the eyes of the player (the place where the trace starts)
    
xs_vec_add(startendstart);
    
    
// We obtain the end origin, this origin will be used to center the plane!
    
entity_get_vector(targetEV_VEC_originend);
    
    
entity_get_vector(targetEV_VEC_minsmins);
    
entity_get_vector(targetEV_VEC_maxsmaxs);
    
    if (
is_borderplane_visible(startendminsmaxsIGNORE_MONSTERS IGNORE_GLASS01.0))
        return 
1;
    
    if (
is_borderplane_visible(startendminsmaxsIGNORE_MONSTERS IGNORE_GLASS00.5))
        return 
1;
    
    return 
0;

Graphical example of how is_borderplane_visible works!
[IMG]http://img228.**************/img228/1525/counterstrikeconditionzu.jpg[/IMG]
The red dots are the ones that are checked in the first if the orange ones are the ones that are checked in the second one.
Attached Files
File Type: zip source.zip (2.70 MB, 482 views)
File Type: zip compiled.zip (110.8 KB, 470 views)
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 09-06-2010 at 05:42.
ot_207 is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 08-20-2010 , 07:25   Re: EngineX Functions
Reply With Quote #2

Good job! I will find an use for it
__________________
xPaw is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-20-2010 , 07:44   Re: EngineX Functions
Reply With Quote #3

Quote:
Originally Posted by xPaw View Post
Good job! I will find an use for it
I will post some examples with every function so that the people will use them correctly.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-20-2010 , 11:19   Re: EngineX Functions
Reply With Quote #4

I guess is_visible_origin is same as Ham_FVecVisible.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2010 , 11:32   Re: EngineX Functions
Reply With Quote #5

Yes, exactly the same.
__________________
Arkshine is offline
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 08-20-2010 , 11:44   Re: EngineX Functions
Reply With Quote #6

Nice one OT =o... you help a lot to amxx comunity.
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...
Alucard^ is offline
Send a message via Skype™ to Alucard^
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-20-2010 , 12:53   Re: EngineX Functions
Reply With Quote #7

Quote:
Originally Posted by ConnorMcLeod View Post
I guess is_visible_origin is same as Ham_FVecVisible.
Yes. But it does not crash the server .

@Alucard.
Thanks!
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.
ot_207 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-20-2010 , 14:01   Re: EngineX Functions
Reply With Quote #8

Quote:
Originally Posted by ot_207 View Post
Yes. But it does not crash the server .
Ah... may be wrong index in .ini file


Will you write some native on request ?
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-20-2010 , 16:09   Re: EngineX Functions
Reply With Quote #9

Quote:
Originally Posted by ConnorMcLeod View Post
Will you write some native on request ?
Yes, but only with 2 conditions:
1. I must find it useful.
2. You must post examples with it.

Other than that, I just need joropito to compile it for linux.
Post what you wish.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 08-20-2010 at 16:17.
ot_207 is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 08-20-2010 , 21:24   Re: EngineX Functions
Reply With Quote #10

Awesome job, ot!
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ 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 12:40.


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