General hamsandwich questions
I would like to have available for scripting some functions existent in CS.
Particularly functions related to spectating. I don't know any method of manipulating that now. I would like to have them to make a plugin that would force players with the same IP to be able only to spectate their lanmates and a plugin that would make admins able to go through players by their scores, like the first one to spectate would be the person with the highest score and another plugin that when one player were carrying a knife and was closer to an enemy would force those who want to spectate him. I guess those functions are: Observer_FindNextPlayer Observer_SetMode Observer_HandleButtons Observer_FindNextPlayer A part from these i also would like to have: FlashlightTurnOn FlashlightTurnOff To be able to use the flashlight button in plugins. Also: SetNewPlayerModel SetPlayerModel That I guess that would make clean the way of changing player models Also: SetAnimation I understand the concept of hamsandwich and I know that with it and by knowing the function offsets in the entity virtual table one could easily add support to almost any function with it. My question is, if someone can find any of these offsets or point me to reading material to understand how to figure out how to get those offsets. Apart from that, I learnt that by doing PHP Code:
|
Re: General hamsandwich questions
Is that ObjectCaps better than this?
Code:
|
Re: General hamsandwich questions
Quote:
|
Re: General hamsandwich questions
Quote:
|
Re: General hamsandwich questions
1 Attachment(s)
Try this to see the difference.
|
Re: General hamsandwich questions
vtable only contains virtual member function pointers, all of your provided functions are non virtual member function, they
don't exist in CBasePlayer's Obj's vtable. calling function is simple if you know its real address, prototype and calling conventions. here is an example to call CBasePlayer::DropPlayerItem(const char *szItem), I use it to instead "engclient_cmd" method to force a player drop an item. Code:
void CallDllDropPlayerItem(edict_t *pEdict, const char *szWeapon)Then find the function address you want to call. By this way, you can call all the functions you list above. Hooking them is another story. To get virtual offsets, here is a tut: http://wiki.alliedmods.net/Finding_Virtual_Offsets |
Re: General hamsandwich questions
Quote:
(And that was a nice example. I also don't like to use engclient_cmd) |
Re: General hamsandwich questions
I have one question. How do you know if a function is virtual or not by analizing the library dump and, how you get the position, in the virtual table of the entity, for those which are virtual?
(edit: I'm guessing that the virtual functions are those who are inherited from base classes and not those from the actual class) |
Re: General hamsandwich questions
Just to say that i've just figured out that ObjectCaps is not a reliable method to detect player pressing +use key.
If some players stay near to that player, ObjectCaps is triggered also for those players, which trigger false positives. You could say that checking for pev_button could fix it, but if the 'near' player is also holding +use, then the function is sent 2 times instead of 1, and button check gonna be past. |
| All times are GMT -4. The time now is 15:33. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.