Raised This Month: $ Target: $400
 0% 

Player respawn event


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Haircut
Member
Join Date: Mar 2004
Location: UK
Old 08-31-2004 , 12:10   Player respawn event
Reply With Quote #1

Player respawn event, I'm looking for a way to do this.

Ive tried:
Code:
    register_event("ResetHUD","re_spawn","b")
but it doesn't seem to work all the time.

Maybe I'm doing something wrong, here is the whole plug-in (v0.16):

Code:
#include <amxmodx> #include <fun> //--------------------------------------------------------------------------// public plugin_init() {     register_plugin("Spawn Protection","0.1","Haircut")     register_cvar("amx_god","1")     register_cvar("amx_godtime","5")     register_event("ResetHUD","re_spawn","b") } public client_disconnect (id) {     if (task_exists(id))         remove_task(id)     return PLUGIN_CONTINUE } //--------------------------------------------------------------------------// public re_spawn(id) {    if (!(get_cvar_num("amx_god") == 1))       return PLUGIN_CONTINUE    set_user_godmode(id, 1)        new Float:protect_time = get_cvar_float("amx_godtime")        set_hudmessage( 255, 0, 0, -1.0, 0.4, 0, 6.0, protect_time, 0.5, 1.5, 2 )    show_hudmessage(id, "SPAWN PROTECTION IS ENABLED FOR %.0f SECONDS", protect_time)        set_task(protect_time, "god_off", id)    return PLUGIN_CONTINUE } //--------------------------------------------------------------------------// public god_off(id) {     set_user_godmode(id)     return PLUGIN_CONTINUE }
__________________
MardyMouse.co.uk
MardyMouse.co.uk UK DoD Server IP: 83.142.52.21:27015
Haircut is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 08-31-2004 , 12:31  
Reply With Quote #2

quick look at this code and for me it should work.
ResetHUD event isn't always executed ?

I will try to check this later ( Now I going to play on your server )
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Votorx
Senior Member
Join Date: Jun 2004
Old 08-31-2004 , 13:55  
Reply With Quote #3

You can try this, it works almost perfectly for when the round restarts:

Code:
register_event("RoundTime", "new_round", "bc") public new_round() {     if ( floatround(get_cvar_float("mp_roundtime") * 60.0) != read_data(1) ) return PLUGIN_CONTINUE     //Put the code you want to happen at a new round }

But that's for a new round. It seems like you want to call an event every time a person dies, respawn them and protect them for a certain amount of time, if this is the case then you should use

Code:
register_event("DeathMsg","Function", "a")
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 08-31-2004 , 17:45  
Reply With Quote #4

He need this for DoD....
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Votorx
Senior Member
Join Date: Jun 2004
Old 08-31-2004 , 17:54  
Reply With Quote #5

>.> ok...but these functions aren't mod dependant are they?
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Peli
Veteran Member
Join Date: Mar 2004
Location: San Diego, CA
Old 08-31-2004 , 19:19  
Reply With Quote #6

Is there spawn killing in DoD?
Peli is offline
Send a message via MSN to Peli
Haircut
Member
Join Date: Mar 2004
Location: UK
Old 09-01-2004 , 04:57  
Reply With Quote #7

Therwe is spawn killing when the map is de_dust. That is de_dust on a DoD Server

So I need to have spawn protection for when players re-spawn.

Quote:
ResetHUD event isn't always executed ?
I don't know, all I know is the Text doesn't always appear, whether the client has god mode, well ... that's another thing.


Votorx

I did think about that but the problem is the way DoD re-spawns palyers. It happens in waves of something like 5-10 seconds (Server variable), not when the individual player dies.

This makes it difficult to know how long the player will have to wait until they respawn, as this can be anything from instantly to 10 seconds.
__________________
MardyMouse.co.uk
MardyMouse.co.uk UK DoD Server IP: 83.142.52.21:27015
Haircut is offline
SidLuke
Senior Member
Join Date: Mar 2004
Location: Poland, Chrzanow
Old 09-01-2004 , 05:03  
Reply With Quote #8

so also use client_print(..) , show_message may not be displayed (only 4 shared chanels)
SidLuke is offline
Send a message via AIM to SidLuke Send a message via MSN to SidLuke
Votorx
Senior Member
Join Date: Jun 2004
Old 09-01-2004 , 14:02  
Reply With Quote #9

I see...Well ResetHUD isn't a very reliable event...

So you may want to do something like this:

Code:
new IsDead[32] public server_frame(){ new player[32], num get_players(player, num) for(new x = 0; x <= num, x++){ if(!is_user_alive(player[x]){ IsDead[x] = 1 } else if((is_user_alive(player[x])) && (IsDead[x] == 1)){ Set_Task(.1; "Whatever function to give them god") IsDead[x] = 0 } }

Try some like that to get whenever a player respawns.
__________________
Currently Looking for a mod team.
Votorx is offline
Send a message via AIM to Votorx Send a message via MSN to Votorx Send a message via Yahoo to Votorx
Johnny got his gun
Veteran Member
Join Date: Jan 2004
Location: Tokyo
Old 09-02-2004 , 04:59  
Reply With Quote #10

With fakemeta this will probably be very easy. Hook the spawn function itself, and there you go. Maybe you want to hook the post one, and so the forward will be called right after a player has spawned (before is probably not a good idea). In the forward function check if entity is 1 <=> maxplayers, and then set him to godmode for a few secs... and maybe a settask to ungodmode back in 5 secs... I just guess DoD also uses the Spawn function to respawn players.
Johnny got his gun 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 17:17.


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