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

help with okapi


Post New Thread Reply   
 
Thread Tools Display Modes
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-22-2017 , 12:30   Re: help with okapi
Reply With Quote #21

1.I already understand , Symbols for linux because all the functions are exported(i think?) and Most of cases signatures for windows(because some functions are not expoerted, they are sub_*** .. ) .

2.Can you better PLEASE attach cs.so and mp.dll of yours? I don't want to update my server because is just for testing.

3. Ok , the thing with okapi supercede with post = 0 (pre) is working, now i have an another question and i start an hard sesion of learning .

Can you explain how okapi_call works ? Or how i can *activate* functions? Like calling SG_Detonate for an player entity from a function ( as ExecuteHam() works ).
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-22-2017 , 12:38   Re: help with okapi
Reply With Quote #22

2. IIRC you can find it just by downloading CS 1.6 from Steam. I believe you get binaries for all 3 systems (for whatever reason). You can also just install SteamCMD on your PC and download server files.

Last edited by klippy; 06-22-2017 at 12:39.
klippy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-22-2017 , 12:47   Re: help with okapi
Reply With Quote #23

Quote:
Originally Posted by KliPPy View Post
2. IIRC you can find it just by downloading CS 1.6 from Steam. I believe you get binaries for all 3 systems (for whatever reason). You can also just install SteamCMD on your PC and download server files.
mp.dll and cs.so are not Server-Side files?

And no, i don't have all 3 binaries.

About SteamCMD, i've installed and it give me lot of files wich have nothing to do with cs -servers, sorry but i realy don't know how to use SteamCMD and i don't have a reason to do that, i just need 2 files.
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-22-2017 , 12:53   Re: help with okapi
Reply With Quote #24

There is a tutorial in this forum, search for it. We can't just upload the files.

You call a function by the value returned from okapi_build_method/function.
__________________

Last edited by HamletEagle; 06-22-2017 at 12:54.
HamletEagle is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 06-22-2017 , 13:44   Re: help with okapi
Reply With Quote #25


Both server and client files are shipped. gamedir/dlls contains server binaries, gamedir/cl_dlls contains client binaries.
klippy is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-22-2017 , 14:17   Re: help with okapi
Reply With Quote #26

i found them, thank you klippy!
__________________
Project: Among Us
Craxor is offline
Send a message via ICQ to Craxor
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-23-2017 , 09:37   Re: help with okapi
Reply With Quote #27

Here's my first plugin using Okapi, i didn't use signatures just symbol, because in windows SG_Detonate has a symbol as hamlet teach me .

This plugin is designed to teleport you where you throw the Smokegrenade and then stop Detonate calling.

Any opinions?
Code:
    #include <amxmodx>
    #include <fakemeta>
    #include <okapi>

    new const szPluginInfo[] [] =
    {
        "SmokeGrenade Teleportation",
        "v1.0",
        "Craxor"
    };

        new const WSymbl[ ] = "?SG_Detonate@CGrenade@@QAEXXZ";
        new const LSymbl[ ] = "_ZN8CGrenade11SG_DetonateEv";

    new unstuck[33];

    public plugin_init()
    {
        register_plugin
        (
            szPluginInfo[0],
            szPluginInfo[1],
            szPluginInfo[2]
        );

        new HandleSgDetonate;
        if
        (
            ( HandleSgDetonate = okapi_mod_get_symbol_ptr(WSymbl) ) ||
            ( HandleSgDetonate = okapi_mod_get_symbol_ptr(LSymbl) )
        )
        {
               okapi_add_hook(okapi_build_method(HandleSgDetonate, arg_void, arg_cbase ), "Okapi_SG_Detonate_Func", .post = 0);
        }
    }

    public Okapi_SG_Detonate_Func(const ent)
    {
        if( !pev_valid(ent) )
            return okapi_ret_ignore;
    
        new id = pev( ent, pev_owner );
    
        if( is_user_alive(id) )
        { 
            new Float:EntOrigin[3];
            pev( ent, pev_origin, EntOrigin)
    
            EntOrigin[2] +=100.0;
            
            set_pev( id, pev_origin, EntOrigin );
            
            engfunc( EngFunc_RemoveEntity, ent );
            set_task( 1.0, "check_if_stuck", id );
        }
    
        return okapi_ret_supercede;
    }

    public check_if_stuck( id )
    {
        if( is_user_alive(id) && is_player_stuck(id) )
        {  
            if( unstuck[id] < 3 )
            {
                new Float:Or[3]; pev( id, pev_origin, Or );
                Or[2] += 100.0;


		if( unstuck[id] > 1 )
		{
                    new x = random_num( 0, 1);
            
                    if( x > 0 )
                        Or[1] += random_float( 30.0, 1500.0 );
                    else
                        Or[1] -= random_float( 10.0, 1500.0 );
                }

                set_pev( id, pev_origin, Or );
		unstuck[id]++;
            }

            else
            {
                user_silentkill(id);
                unstuck[id] = 0;
            }

            client_print( id, print_center, "unstucking in proces....(tryies %i/3", unstuck[id]);
            set_task( 1.0, "check_if_stuck", id );
        }
    } 

    /*    Check if a player is stuck (credits to VEN)	*/ 
    stock is_player_stuck(id) 
    { 
        static Float:originF[3] 
        pev(id, pev_origin, originF) 
         
        engfunc(EngFunc_TraceHull, originF, originF, 0, (pev(id, pev_flags) & FL_DUCKING) ? HULL_HEAD : HULL_HUMAN, id, 0) 
         
        if (get_tr2(0, TR_StartSolid) || get_tr2(0, TR_AllSolid) || !get_tr2(0, TR_InOpen)) 
            return true; 
        return false; 
    }

    public client_putinserver(id) unstuck[id] = 0;
    public client_disconnected(id) unstuck[id] = 0;
Edit, i've made the plugin a little more hardcoded and poor just for fun, haha(the important part are with okapi because is for testing/learning).
__________________
Project: Among Us

Last edited by Craxor; 06-23-2017 at 13:02.
Craxor is offline
Send a message via ICQ to Craxor
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-24-2017 , 02:57   Re: help with okapi
Reply With Quote #28

i stil don't understnd how okapi_call works ... here's what i've done ... ( symbol just for windows, because is just for testing. ) :

PHP Code:
#include <amxmodx>
#include <okapi>

new const Symb[] = "?ItemTouch@CItem@@QAEXPAVCBaseEntity@@@Z"
new okapi_func:test;

public 
plugin_init()
{
    new 
Handle okapi_mod_get_symbol_ptrSymb );
    
test okapi_build_methodHandlearg_voidarg_cbase );

    
register_clcmd"say /test""testp" );
}

public 
testp(id)
{
        
// 22 should be m4a1 ent id
    
okapi_calltest22id );


The function reference: https://github.com/s1lentq/ReGameDLL...items.cpp#L110
__________________
Project: Among Us

Last edited by Craxor; 06-24-2017 at 02:59.
Craxor is offline
Send a message via ICQ to Craxor
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 06-24-2017 , 04:11   Re: help with okapi
Reply With Quote #29

You are missing an arg_cbase from param list
Also 22 can't be it's ENTITY INDEX, because 1 to 32 are reserved for players.

Are you trying to force touch witj an armoury_entity?
__________________
HamletEagle is offline
Craxor
Veteran Member
Join Date: Jan 2016
Location: Romania
Old 06-24-2017 , 06:06   Re: help with okapi
Reply With Quote #30

Nope, i already get it wrong, ItemTouch is called when i touch an Kevlar(buy+pickup) or an Defuse Kit but just for them.

Normaly my goal was to give an weapon with okapi_call() a simple test just to see the logic of okapi_call().

After some debug tests by calling TouchItem with some items(defuses or kevlars i don't remember well) was having the entid '117' , so i've tried to give it with okapi_call but it was always the same answer: server crash(oh).

Heres the code:
PHP Code:
#include <amxmodx>
#include <okapi>

new const Symb[] = "?ItemTouch@CItem@@QAEXPAVCBaseEntity@@@Z"
new okapi_func:test;

public 
plugin_init()
{
    new 
Handle okapi_mod_get_symbol_ptrSymb );
    
test okapi_build_methodHandlearg_voidarg_cbasearg_cbase );

    
register_clcmd"say /test""testp" );
}

public 
testp(id)
{
    
okapi_calltest117id );

__________________
Project: Among Us

Last edited by Craxor; 06-24-2017 at 06:33.
Craxor is offline
Send a message via ICQ to Craxor
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:58.


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