PDA

View Full Version : Orpheu -> virtualFunctions


Dr.G
02-14-2010, 04:56 PM
This is a quick test of the Orpheu module. It looks like its working very well...

Is this better then Hamsandwich? I dont know, but its looks more stabil IMO.


/* Plugin generated by AMXX-Studio */
////////////////////////////////////////////////////////////////////////////////////////////////////
#include <amxmodx>
#include <Orpheu>
////////////////////////////////////////////////////////////////////////////////////////////////////
#define PLUGIN "DoD Orpheu testing"
#define VERSION "1.0 by Dr.G"
#define AUTHOR "AMXX DoD Team"
////////////////////////////////////////////////////////////////////////////////////////////////////
/* NOTE: */
/* CBasePlayer::PreThink(void) -> Offset WIN32 = 132 */

/* CBasePlayer::Spawn(void) -> Offset WIN32 = 3 */

/* CBasePlayer::Killed(entvars_s *, int) -> Offset WIN32 = 20 */

/* THESE are offsets for Day of Defeat! */
////////////////////////////////////////////////////////////////////////////////////////////////////
new i[33] = 0
new time_to_run
new counter[33] = 0
new is_alive[33] = 0
////////////////////////////////////////////////////////////////////////////////////////////////////
public plugin_init()
{

register_plugin(PLUGIN, VERSION, AUTHOR)

new OrpheuFunction:iThink = OrpheuGetFunctionFromClass("player", "PreThink", "CBasePlayer" )
OrpheuRegisterHook(iThink,"think_Player")

new OrpheuFunction:Player_Spawn = OrpheuGetFunctionFromClass("player", "Spawn", "CBasePlayer" )
OrpheuRegisterHook(Player_Spawn,"Spawn")

new OrpheuFunction:Player_Killed = OrpheuGetFunctionFromClass("player","Killed", "CBasePlayer" )
OrpheuRegisterHook(Player_Killed,"player_Killed")

time_to_run = register_cvar("time_to_run","30")

register_clcmd("say /thinktest","start_Test")

}
////////////////////////////////////////////////////////////////////////////////////////////////////
public start_Test(id)
{
set_task( get_pcvar_float(time_to_run), "stop_Test", id )
counter[id] = 0
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public stop_Test(id)
{
client_print(id, 3, "*Thinks per Sec: %d", (counter[id]/get_pcvar_num(time_to_run)))
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public Spawn(player) //looks like its pre..
{
set_task(1.0, "Spawn_Delayed", player)
}
////////////////////////////////////////////////////////////////////////////////////////////////////
public Spawn_Delayed(id)
is_alive[id] = is_user_alive(id)
////////////////////////////////////////////////////////////////////////////////////////////////////
public think_Player(player)
{
counter[player]++


if(i[player] == 600)
{
i[player] = 0

if(is_alive[player])
{
client_print(player, 3, "*Thinkin' and alive..")
return
}
else
client_print(player, 3, "*Thinkin' and dead..")

}
i[player]++

}
////////////////////////////////////////////////////////////////////////////////////////////////////
public player_Killed(victim, killer, something)
{
is_alive[victim] = 0
client_print(victim, 3, "*You died!")
}
////////////////////////////////////////////////////////////////////////////////////////////////////


Ref.: Orpheu: Using virtual functions
(https://forums.alliedmods.net/showthread.php?t=118138)

-Cheers!

diamond-optic
02-14-2010, 06:43 PM
this is some interesting stuff youve found here... been browsing thru the threads about it on the amxx forums and it seems like this will open a whole ton of new possibilities

Dr.G
02-14-2010, 06:54 PM
It sure will. joaquim andrade unlocked the CS:CZ's build in bots so they would work in CS haha. Its not really user friendly. But will for sure let us do alot of new stuff. I wonder if we somehow can get over the 512 model limit, that would be interessting...

Dr.G
02-14-2010, 09:01 PM
BTW. If you wanna hook other stuff like CWEBLEY eg. you gotta add first in the dod\addons\amxmodx\configs\orpheu\types\CBaseEntit y\aliases just like all the other stuff that allready there. And ofcource you need the signatures for it.
But you might wanna use CBasePlayerWeapon::vtbl insted, but its possible, and a good way to kill a single weapon, so no one can use it like grenades or what ever...

diamond-optic
02-14-2010, 11:28 PM
i only messed around with it for a few minutes.. and just with the simple string replacing stuff and whatnot

Fysiks
02-14-2010, 11:43 PM
Is this better then Hamsandwich? I dont know, but its looks more stabil IMO.


From what I gathered from the conversations if you can use Hamsandwich then you should becuase it has less overhead.

Dr.G
02-15-2010, 12:26 PM
From what I gathered from the conversations if you can use Hamsandwich then you should becuase it has less overhead.

Yes, just read about it, thanks....