PDA

View Full Version : DOD Spawn Forward (Module Fix)


Wilson [29th ID]
03-23-2008, 06:14 PM
The current DoDx module uses the native dod_client_spawn to hook player spawns. However, this does not get called when the round restarts due to a flag cap-out. It also does not get called on simple plugin-based respawns.

Until the module is fixed, I have written a forward to replace it that gets called every time a player spawns no matter the circumstances. To give proper credit, Zor actually found the hook method but hasn't had time to release the fix yet.

This forward is dod_player_spawn (notice the different word so they do not conflict), and will be called whenever a player spawns, including after a round restart/cap-out.

To use this, simply edit all your plugins that are affected and replace dod_client_spawn with dod_player_spawn. Make sure this plugin is listed in your plugins.ini and that's all you'll need to do. No linking, no nothing.

Enjoy.

{DwP} 325th ABN
03-23-2008, 07:20 PM
hell ill give it a go ill post back if any problems sounds good to me

Zor
03-23-2008, 10:46 PM
The newest module fixes this problem...however, you have to get it and use it instead of the current version of amxmodx.

Cheers!

http://www.amxmodx.org/autobuilds

I have uploaded the fixed version using pstatus as willson did here. If you don't want to use the sma forward, you can use the new version of the DoDx.

Cheers!

diamond-optic
03-23-2008, 11:53 PM
ohh wait so 3679 has the fix already? cause the build number hasnt changed for like months now

Wilson [29th ID]
03-24-2008, 02:18 AM
gah! why you no tell me before!

meathead
03-24-2008, 08:57 AM
Was this a windows server only problem?
It looks like they were the only files fixed.

Dr.G
03-24-2008, 10:40 AM
@ meathead

I belive the linux module is fixed too http://www.amxmodx.org/autobuilds/1.8.1-3679/linux-i386/

Zor
03-24-2008, 12:16 PM
Well the last build was:

1.8.1-3679/ 08-Jan-2008 01:00

And I updated the files:

Modified Fri Dec 28 19:13:24 2007 UTC (2 months, 3 weeks ago) by zor
File length: 13339 byte(s)
Diff to previous 3538

Removed the olddeadflag from CPlayer and moved the spawn forward into
the PStatus Client Message

So it should be in there.

Cheers!

=|[76AD]|= TatsuSaisei
05-19-2008, 09:19 PM
neither work properly !!! And here is why...

dropobject

When a user drops an "object" (primarily tnt or satchel) a "spawn" is falsely triggered !!!

upon further "research" of the PStatus method... additional criteria is needed ... as status == 0 is applicable to a "spawn" as well as "dropobject" (this ALSO includes the "usage" of an object)


public msg_PStatus(msgid,msgdest,id)
{
new player = get_msg_arg_int(1);
new status = get_msg_arg_int(2);

if(is_user_connected(player) && status == 0 && msgdest == 2 && !id) set_task(Float:0.2,"spawn_forward",player);
}

Zor
05-19-2008, 10:31 PM
Ok, have been looking at this hopefully I have it now...just going to compile it on linux and see what happens...

diamond-optic
01-27-2009, 10:12 PM
just figured id post how to hook player spawn with hamsandwich since ive seen it not being used correctly

register it in plugin_init:
RegisterHam(Ham_Spawn,"player","func_HamSpawn")then add this function:
public func_HamSpawn(id)
if(is_user_connected(id) && get_user_team(id))
set_task(Float:0.1,"player_spawn",id)then use this function to do whatever you want:
public player_spawn(id)
{
if(is_user_alive(id)
client_print(id,print_chat,"SPAWNED!")


//etc etc etc etc

}if you dont check to see if the player is a on team in the func_HamSpawn then it will also be called when a player connects to the server... idk if theres a diff way to detect just the actual spawning and not when a player connects without checking the team.. but it works

also, you could *try* doing stuff right in the func_HamSpawn function, but in some basic testing i found the player wasnt 'alive' and most things didnt work right.. but the 0.1 second task works fine

Dr.G
01-27-2009, 10:41 PM
Nice! Thanks

diamond-optic
01-27-2009, 10:43 PM
yeah i think its a bit more simple and a little easier to understand then wilson & tatsu's PStatus method that I have been using for a while now..

plus HamSandwich is great lol and im starting to use it more and more as i figure more out about it

diamond-optic
01-27-2009, 10:54 PM
ok my mistake, i forgot to try it in post... as doing so, the player is alive.. so forget about what i posted above.. lets do this again lol..

register it in plugin_init:

RegisterHam(Ham_Spawn,"player","func_HamSpawn",1)


then add this and do whatever you want here... client_print obviously is just for testing...
public func_HamSpawn(id)
{
if(is_user_alive(id) && is_user_connected(id) && get_user_team(id))
{
client_print(0,print_chat,"SPAWN TEST")

//etc etc etc
}
}


the get_user_team check is still needed as it still is called when a player joins the server (tho i tested it only with bots, so maybe its just the creation of a bot.. but either way since alot of servers have bots on them at one point or another, i think its best to leave it in even if that is the case)

Dr.G
01-28-2009, 09:12 AM
lol...i dont get why that get_user_team have to be there, especially not since its returns the team id... but wth if u say it have to be there its good enough to me :) An yes this is way more simple and understandable then Pstatus thing, again gj!

diamond-optic
01-28-2009, 01:11 PM
you know what.. you make a good point.. im late for work so cant bother with it now..

but it actually probably isnt needed lol.. but anyway the reason i put it there tho was cause when a player connects their team is 0 so it wont go past that check.. where as if they actually spawn while on a team it has a value and it passes thru it..

but now that i think about it, the is_user_alive should cover that anyway lol..

i really fucked this up hahah

diamond-optic
01-28-2009, 03:21 PM
ok i just tried it out...

without checking get_user_team it is still called on connection.. for some reason they are marked as being alive even when they havent joined a team...