Raised This Month: $32 Target: $400
 8% 

Solved question about ham_spawn


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-20-2021 , 15:14   question about ham_spawn
Reply With Quote #1

hello. i have a question about this event:

PHP Code:
RegisterHam(Ham_Spawn"player""player_spawn_post"1
What player spawn exactly means ?

When a player is dead and he's respawning or whenever round start (or you execute a command).

If i use sv_restart 1 in console, the event will be applied for each player ? Because i have some trouble in this situations.

Are there better options to detect player spawn without any glitches ??

Last edited by lexzor; 07-22-2021 at 13:30.
lexzor is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-20-2021 , 15:39   Re: question about ham_spawn
Reply With Quote #2

You can find these answers on your own: add messages inside the ham spawn hook and see if it is called when you need it to be called.
Also, there are no glitches. Hamsandwich hooks functions directly from the game code. Ham_Spawn hooks CBasePlayer::Spawn(this is how the game spawns a player) so literally you can't be more accurate than this.
__________________

Last edited by HamletEagle; 07-20-2021 at 15:39.
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-20-2021 , 16:48   Re: question about ham_spawn
Reply With Quote #3

Ham_spawn "player" its called on two different occasions first one is when a client get putinserver a player entity spawns for that client ( doesn't mean a "player" entity was created more like the player entity settings were set ), second one is when a player get revived from death or he gets respawned.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-20-2021 at 16:51.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
lexzor
Veteran Member
Join Date: Nov 2020
Old 07-22-2021 , 07:45   Re: question about ham_spawn
Reply With Quote #4

If i m playing as a Counter-Terrorists and my location is in Terrorists base (i m alive) let s say i'm using sv_restart 1.

The game reset and my new location is in Counter-Terrorists base. It's this called spawn ?
lexzor is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-22-2021 , 08:54   Re: question about ham_spawn
Reply With Quote #5

Quote:
Originally Posted by lexzor View Post
If i m playing as a Counter-Terrorists and my location is in Terrorists base (i m alive) let s say i'm using sv_restart 1.

The game reset and my new location is in Counter-Terrorists base. It's this called spawn ?
Check for yourself. Hook Ham_Spawn, add a message, see if it is being printed when you do what you just described. Is this hard to understand?
__________________
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-22-2021 , 09:59   Re: question about ham_spawn
Reply With Quote #6

Ham_spawn is for entities it has nothing to do with locations

And for player entities they are necessary map entities, they have defined locations from the map maker.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-23-2021 , 10:01   Re: question about ham_spawn
Reply With Quote #7

Quote:
Originally Posted by lexzor View Post
hello. i have a question about this event:

PHP Code:
RegisterHam(Ham_Spawn"player""player_spawn_post"1
What player spawn exactly means ?

When a player is dead and he's respawning or whenever round start (or you execute a command).

If i use sv_restart 1 in console, the event will be applied for each player ? Because i have some trouble in this situations.

Are there better options to detect player spawn without any glitches ??
Try adding short task.
Code:
#include amxmodx #include hamsandwich public plugin_init()     RegisterHam(Ham_Spawn, "player", "player_spawn_post", 1) public player_spawn_post(id)     set_task(1.0, "@player_spawn_post", id) @player_spawn_post(id)     server_print "%n spawned",id
__________________
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-23-2021 , 11:43   Re: question about ham_spawn
Reply With Quote #8

Quote:
Originally Posted by DJEarthQuake View Post
Try adding short task.
Code:
#include amxmodx #include hamsandwich public plugin_init()     RegisterHam(Ham_Spawn, "player", "player_spawn_post", 1) public player_spawn_post(id)     set_task(1.0, "@player_spawn_post", id) @player_spawn_post(id)     server_print "%n spawned",id
Why?
__________________
HamletEagle is offline
DJEarthQuake
Veteran Member
Join Date: Jan 2014
Location: Astral planes
Old 07-24-2021 , 06:25   Re: question about ham_spawn
Reply With Quote #9

Ham_spawn at times is willy-nilly without the tasks. Half sec is fine too.
__________________
DJEarthQuake is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-24-2021 , 11:35   Re: question about ham_spawn
Reply With Quote #10

Quote:
Originally Posted by DJEarthQuake View Post
Ham_spawn at times is willy-nilly without the tasks. Half sec is fine too.
What do you mean by "willy nilly"? Don't need other synonyms, describe the actual issue.
__________________

Last edited by HamletEagle; 07-24-2021 at 11:35.
HamletEagle is offline
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 06:11.


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