Raised This Month: $62 Target: $400
 15% 

Help convert from engine to fakemete


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
thezolotoi
Junior Member
Join Date: Apr 2021
Old 04-17-2021 , 08:39   Help convert from engine to fakemete
Reply With Quote #1

Hi, help me pls)
My code:
PHP Code:
//
Plugin init:
    
register_touch("worldspawn""ent_creeper""touch_wall");
    
register_touch("func_brush""ent_creeper""touch_wall");
    
register_touch("func_breakable""ent_creeper""touch_wall");
//
public touch_wall(entityclient)
{
    if(
g_client_jumpdelay[client] < get_gametime())
    {
        
g_client_jumpdelay[client] = (get_gametime() + 1.0)    
        new 
Float:client_origin[3], Float:client_angle[3];
        
pev(clientpev_originclient_origin);
        
client_origin[2] -= 36.0;
        
pev(clientpev_v_angleclient_angle);


        new 
Float:futur_origin[3];
        
origin_infront(client_angleclient_origin17.0futur_origin);

        new 
trace_handle create_tr2();
        
engfunc(EngFunc_TraceLineclient_originfutur_originDONT_IGNORE_MONSTERSclienttrace_handle);
        
get_tr2(trace_handleTR_vecEndPosfutur_origin);

        if(
get_distance_f(client_originfutur_origin) <= 17.0)
        {
            
engfunc(EngFunc_MakeVectorsclient_angle);
            new 
Float:forward_vector[3];
            
get_global_vector(GL_v_forwardforward_vector);

            
client_angle[0] = forward_vector[0] * 200.0;
            
client_angle[1] = forward_vector[1] * 200.0;
            
client_angle[2] = 220.0;

            
set_pev(clientpev_velocityclient_angle);
            
g_bDrop true;
            
set_task(0.2,"task_on");
        }
    }

thezolotoi is offline
JocAnis
Veteran Member
Join Date: Jun 2010
Old 04-17-2021 , 11:41   Re: Help convert from engine to fakemete
Reply With Quote #2

Why do you need that convertion? If you think because of performance, then no need, its totally the same
__________________
KZ Public Autocup - PrimeKZ

My blog: http://primekz.xyz (in progress...)
JocAnis is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 04-17-2021 , 13:28   Re: Help convert from engine to fakemete
Reply With Quote #3

Difference: 274 NANOSECONDS (that's 0.000 000 274s) per iteration.
Winner: Engine

Can we just kill this stupid idea now?

Code:
#include <amxmodx> #include <engine> #include <fakemeta> #include <rose> public plugin_init() {     register_plugin("Dumb", "1.0", "[ --{[email protected] ]");     register_clcmd("dumb", "dumb_handler"); } public dumb_handler(id) {     new hTimerFakemeta = TimerStart();     for ( new i = 0 ; i < 1000000 ; i++ )         fakemeta_dumb(id);     TimerStop(hTimerFakemeta);     new hTimerEngine = TimerStart();     for ( new i = 0 ; i < 1000000 ; i++ )         engine_dumb(id);     TimerStop(hTimerEngine);     TimerServerPrint(hTimerFakemeta, _, _, "Fakemeta: %t");     TimerServerPrint(hTimerEngine, _, _, "Engine: %t"); } fakemeta_dumb(client) {     new Float:client_origin[3], Float:client_angle[3];     pev(client, pev_origin, client_origin);     pev(client, pev_v_angle, client_angle);     new Float:futur_origin[3];     velocity_by_aim(client, 16, futur_origin);     calcVec(futur_origin, =, futur_origin, +, client_origin);     new trace_handle = create_tr2();     engfunc(EngFunc_TraceLine, client_origin, futur_origin, DONT_IGNORE_MONSTERS, client, trace_handle);     get_tr2(trace_handle, TR_vecEndPos, futur_origin);     if(get_distance_f(client_origin, futur_origin) <= 17.0)     {         engfunc(EngFunc_MakeVectors, client_angle);         new Float:forward_vector[3];         global_get(glb_v_forward, forward_vector);         set_pev(client, pev_velocity, client_angle);     } } engine_dumb(client) {     new Float:client_origin[3], Float:client_angle[3];     entity_get_vector(client, EV_VEC_origin, client_origin);     entity_get_vector(client, EV_VEC_v_angle, client_angle);     new Float:futur_origin[3];     velocity_by_aim(client, 16, futur_origin);     calcVec(futur_origin, =, futur_origin, +, client_origin);     trace_line(client, client_origin, futur_origin, futur_origin);     if(get_distance_f(client_origin, futur_origin) <= 17.0)     {         engfunc(EngFunc_MakeVectors, client_angle); // No replacement         new Float:forward_vector[3];         get_global_vector(GL_v_forward, forward_vector);         entity_set_vector(client, EV_VEC_velocity, client_angle);     } }

Code:
Fakemeta: 03.268
Engine: 02.994
Attached Files
File Type: inc rose.inc (14.0 KB, 1 views)
__________________

Last edited by Black Rose; 04-17-2021 at 14:16.
Black Rose is offline
Reply


Thread Tools
Display Modes

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 22:31.


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