AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved question about ham_spawn (https://forums.alliedmods.net/showthread.php?t=333543)

lexzor 07-20-2021 15:14

question about ham_spawn
 
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 ??

HamletEagle 07-20-2021 15:39

Re: question about ham_spawn
 
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.

Natsheh 07-20-2021 16:48

Re: question about ham_spawn
 
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.

lexzor 07-22-2021 07:45

Re: question about ham_spawn
 
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 ?

HamletEagle 07-22-2021 08:54

Re: question about ham_spawn
 
Quote:

Originally Posted by lexzor (Post 2753357)
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?

Natsheh 07-22-2021 09:59

Re: question about ham_spawn
 
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.

DJEarthQuake 07-23-2021 10:01

Re: question about ham_spawn
 
Quote:

Originally Posted by lexzor (Post 2753247)
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

HamletEagle 07-23-2021 11:43

Re: question about ham_spawn
 
Quote:

Originally Posted by DJEarthQuake (Post 2753452)
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?

DJEarthQuake 07-24-2021 06:25

Re: question about ham_spawn
 
Ham_spawn at times is willy-nilly without the tasks. Half sec is fine too.

HamletEagle 07-24-2021 11:35

Re: question about ham_spawn
 
Quote:

Originally Posted by DJEarthQuake (Post 2753529)
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.


All times are GMT -4. The time now is 00:27.

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