Raised This Month: $ Target: $400
 0% 

Hamsandwich Updating


Post New Thread Closed Thread   
 
Thread Tools Display Modes
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 01-04-2012 , 16:22   Re: Hamsandwich Updating
#81

Quote:
Originally Posted by NiHiLaNTh View Post
I dont want to sound stupid, but doesn't RegisterHamFromEntity does the thing you need?
Quote:
Originally Posted by Arkshine View Post
Yes, it exists already a way to register forwards with Ham using RegisterHamFromEntity, like here https://forums.alliedmods.net/showpo...9&postcount=85.
thats not the point, you both think i am stupit?
i already use RegisterHamFromEntity on here, here, here, here, here and here.
all other modules supporting cz bots, thats why i am asking for it, like:
PHP Code:
RegisterHam(Ham_Spawn"BOT""fw_PlayerSpawn_Post"1
now you understood? regards.
__________________

Working on:
nothing

Last edited by schmurgel1983; 01-04-2012 at 16:23.
schmurgel1983 is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-04-2012 , 16:30   Re: Hamsandwich Updating
#82

From superheromod.sma:
Code:
public client_putinserver(id)
{
	if ( id < 1 || id > gServersMaxPlayers ) return

	gPlayerPutInServer[id] = true

	// Find czero bots to register Ham_Spawn
	if ( gIsCzero && pev(id, pev_flags) & FL_FAKECLIENT && get_pcvar_num(bot_quota) > 0 && !gCZBotRegisterHam ) {
		// These bots will not have the inital Ham_Spawn call because the ham is registered after that call.
		gBlockedFirstHamSpawn[id] = true

		// Delay for private data to initialize
		set_task(0.1, "czbotHookHam", id)
	}
Code:
public czbotHookHam(id)
{
	// Thx to Avalanche and GunGame for which this method is based on.
	if ( gCZBotRegisterHam || !is_user_connected(id) ) return

	// Make sure it's a bot and if quota greater than 0 it's a cz bot.
	if ( pev(id, pev_flags) & FL_FAKECLIENT && get_pcvar_num(bot_quota) > 0) {
		// Post-spawn fix for cz bots, since RegisterHam does not work for them.
		RegisterHamFromEntity(Ham_Spawn, id, "ham_PlayerSpawn", 1)

		gCZBotRegisterHam = true
	}
}
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
bibu
Veteran Member
Join Date: Sep 2010
Old 01-04-2012 , 16:48   Re: Hamsandwich Updating
#83

Emp still doesn't understand him.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
nikhilgupta345
Veteran Member
Join Date: Aug 2009
Location: Virginia
Old 01-04-2012 , 16:58   Re: Hamsandwich Updating
#84

Quote:
Originally Posted by schmurgel1983 View Post
thats not the point, you both think i am stupit?
i already use RegisterHamFromEntity on here, here, here, here, here and here.
all other modules supporting cz bots, thats why i am asking for it, like:
PHP Code:
RegisterHam(Ham_Spawn"BOT""fw_PlayerSpawn_Post"1
now you understood? regards.
I don't understand the use of doing that. If it already has RegisterHamFromEntity, and it works correctly, what's the point of adding it to RegisterHam?

And this module DOES support cz bots, but not using RegisterHam. So you can't say that all other modules support it and this one does not.
__________________
Quote:
Originally Posted by DarkGod View Post
nikhilgupta generates his plugins using sheer awesome.
If you like my work, please
nikhilgupta345 is offline
Send a message via ICQ to nikhilgupta345 Send a message via Yahoo to nikhilgupta345
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 01-04-2012 , 18:34   Re: Hamsandwich Updating
#85

Quote:
Originally Posted by nikhilgupta345 View Post
I don't understand the use of doing that. If it already has RegisterHamFromEntity, and it works correctly, what's the point of adding it to RegisterHam? And this module DOES support cz bots, but not using RegisterHam. So you can't say that all other modules support it and this one does not.
Quote:
Originally Posted by bibu View Post
nikhilgupta345 still doesn't understand him.
RegisterHam support all solid integrated entities... all? no...
support all weapon_*, monster_*, players etc.
why not BOT entity from condition zero?

RegisterHamFromEntity is most used by custom entity.
but cz bot custom? no.

now its have made click?

is this possible to made cz bot support for normal RegisterHam ?
[ ] yes [ ] no ? can/will you made it?
__________________

Working on:
nothing
schmurgel1983 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 01-04-2012 , 18:39   Re: Hamsandwich Updating
#86

It's pointless to ask for such a feature. Also, "BOT" is not an entity class so it does not belong in RegisterHam().
__________________

Last edited by fysiks; 01-04-2012 at 18:39.
fysiks is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 01-04-2012 , 19:17   Re: Hamsandwich Updating
#87

CZ Bots are not registered with RegisterHam because of how they are created.

I am not entirely sure why (ask Avalanche or vittu; they can probably give better reasoning) but I would assume it is how they are created, possibly as a different entity than "player".

If you want to register a ham for a CZ bot then you need to use RegisterHamFromEntity with the bot's id like the aforementioned code.
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
schmurgel1983
Veteran Member
Join Date: Aug 2006
Location: Germany
Old 01-04-2012 , 20:45   Re: Hamsandwich Updating
#88

Quote:
Originally Posted by fysiks View Post
It's pointless to ask for such a feature. Also, "BOT" is not an entity class so it does not belong in RegisterHam().
that feature are not pointless, this makes easier for cz bot support...
many scripters don't use RegisterHamFromEntity, only they know about cz bots. that were a nice f**king feature.
Quote:
Originally Posted by Emp` View Post
CZ Bots are not registered with RegisterHam because of how they are created.
If you want to register a ham for a CZ bot then you need to use RegisterHamFromEntity with the bot's id like the aforementioned code.
i know, i know ^^
__________________

Working on:
nothing
schmurgel1983 is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 01-04-2012 , 22:51   Re: Hamsandwich Updating
#89

I know a bit about this stuff so I can make it clear for you:

RegisterHam and RegisterHamFromEntity are ways of reaching a class' virtual table. You can read about it here: http://en.wikipedia.org/wiki/Virtual_method_table

RegisterHam does it by asking the game to create a dummy entity by using a classname like "weapon_ak47" that isn't more than a way of reaching the C++ class CAK47 (I think that's the name).

CZ Bots C++ class is CCSBot but there isn't a half life classname linked to it just for the reason that CCSBot are not considered entities or didn't need to be considered entities. So, you can't use RegisterHam with CZ Bots because there isn't a connection between classnames and the C++ class CCSBot.
joaquimandrade is offline
yokomo
Surprise Ascot!
Join Date: May 2010
Location: Malaysia
Old 01-05-2012 , 01:04   Re: Hamsandwich Updating
#90

Quote:
Originally Posted by joaquimandrade View Post
I know a bit about this stuff so I can make it clear for you:

RegisterHam and RegisterHamFromEntity are ways of reaching a class' virtual table. You can read about it here: http://en.wikipedia.org/wiki/Virtual_method_table

RegisterHam does it by asking the game to create a dummy entity by using a classname like "weapon_ak47" that isn't more than a way of reaching the C++ class CAK47 (I think that's the name).

CZ Bots C++ class is CCSBot but there isn't a half life classname linked to it just for the reason that CCSBot are not considered entities or didn't need to be considered entities. So, you can't use RegisterHam with CZ Bots because there isn't a connection between classnames and the C++ class CCSBot.
Then can you make a hamsandwich stock to registerham for CZbot? I found this stock to registerham for CZbot. We need this kind of stock to make our coding job simple.

Please take a look.
PHP Code:
/**
 * Hooks the virtual table for CZ Bots entity class.
 * An example would be: RegisterHamBots(Ham_TakeDamage, "player_hurt");
 * Look at the Ham enum for parameter lists.
 *
 * @param function        The function to hook.
 * @param callback        The forward to call.
 * @param post            Whether or not to forward this in post.
 * @return                 Returns a handle to the forward.  Use EnableHamForwardBots/DisableHamForwardBots to toggle the forward on or off.
 */
native RegisterHamBots(Ham:function, const Callback[], Post=0); 
Attached Files
File Type: sma Get Plugin or Get Source (cs_ham_bots_api.sma - 648 views - 7.3 KB)
__________________
Team-MMG CS1.6 Servers:
✅ MultiMod -- 103.179.44.152:27016
✅ Zombie Plague -- 103.179.44.152:27015
✅ Zombie Escape -- 103.179.44.152:27017
✅ Klassik Kombat -- 103.179.44.152:27018
✅ Boss-Battle -- 103.179.44.152:27019
yokomo is offline
Closed Thread



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 09:42.


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