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

help me with this respawn plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
gfxchris
Member
Join Date: Feb 2016
Old 02-13-2021 , 12:54   help me with this respawn plugin
Reply With Quote #1

hello,i come with a request,if somebody can explain to me this
the stbresp.sma is the file that works well,but it has one flaw
im using this plugin on a surf server,and there are maps that kill players,and they don't respawn anymore,only if they write /respawn
i want the players to be respawned regardless of what they're killed from

for example if they are moving to spectator then moving back into the game,i want them to be respawned automatically,if they are killed by worldspawn or something,i want them to be respawn automatically

right now it only works if they kill eachother
Attached Files
File Type: sma Get Plugin or Get Source (stbresp.sma - 19 views - 2.6 KB)
gfxchris is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-13-2021 , 15:43   Re: help me with this respawn plugin
Reply With Quote #2

This is what I use on my server.
Doesn't detect spectator change, you'll have to add that separately.
Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_Killed, "player", "fwd_HamKilled"); } public fwd_HamKilled(Victim, Attacker, Shouldgib)     set_task(1.0, "RespawnPlayer", Victim); public RespawnPlayer(id) {     if ( ! is_user_connected(id) )         return;         ExecuteHamB(Ham_Spawn, id); }
__________________

Last edited by Black Rose; 02-13-2021 at 15:47.
Black Rose is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-13-2021 , 17:54   Re: help me with this respawn plugin
Reply With Quote #3

Quote:
Originally Posted by Black Rose View Post
This is what I use on my server.
Doesn't detect spectator change, you'll have to add that separately.
Code:
#include <amxmodx> #include <hamsandwich> public plugin_init() {     RegisterHam(Ham_Killed, "player", "fwd_HamKilled"); } public fwd_HamKilled(Victim, Attacker, Shouldgib)     set_task(1.0, "RespawnPlayer", Victim); public RespawnPlayer(id) {     if ( ! is_user_connected(id) )         return;         ExecuteHamB(Ham_Spawn, id); }
If you are using this in a counter-strike server you should use Ham_CS_RoundRespawn instead of Ham_Spawn
__________________
Accepting private $$$ plugins requests.

@Steam: crazy770
@Discord: CrazY.#5317

Website | Channel

CrazY. is offline
gfxchris
Member
Join Date: Feb 2016
Old 02-21-2021 , 07:56   Re: help me with this respawn plugin
Reply With Quote #4

that's not what i want,the plugin that i have above,cause it works good but theres that flaw,for example the map surf_strange2 has a jail in the middle,that explodes and kills all players,and they have to write /respawn to revive them,they're not respawning automatically

for example,this plugin
https://forums.alliedmods.net/showthread.php?p=216734
does it correctly,the respawn from surf olympics works very well but i can't set a delay for the respawn,like the one i posted has,where i can change the delay with "surf_respawn_time" which i set to be 0.5 seconds
gfxchris is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-21-2021 , 16:28   Re: help me with this respawn plugin
Reply With Quote #5

Quote:
Originally Posted by gfxchris View Post
that's not what i want,the plugin that i have above,cause it works good but theres that flaw,for example the map surf_strange2 has a jail in the middle,that explodes and kills all players,and they have to write /respawn to revive them,they're not respawning automatically

for example,this plugin
https://forums.alliedmods.net/showthread.php?p=216734
does it correctly,the respawn from surf olympics works very well but i can't set a delay for the respawn,like the one i posted has,where i can change the delay with "surf_respawn_time" which i set to be 0.5 seconds
just switch out the deathmsg call to ham_killed like Black Rose showed and it will be fixed
jimaway is offline
gfxchris
Member
Join Date: Feb 2016
Old 02-22-2021 , 12:19   Re: help me with this respawn plugin
Reply With Quote #6

this is how i edited it,but it gives me errors

Code:
L 02/22/2021 - 18:05:16: [CSTRIKE] Player out of range (0)
L 02/22/2021 - 18:05:16: [AMXX] Displaying debug trace (plugin "stb.amxx")
L 02/22/2021 - 18:05:16: [AMXX] Run time error 10: native error (native "cs_get_user_team")
L 02/22/2021 - 18:05:17: [AMXX]    [0] stb.sma::Respawning (line 134)
Attached Files
File Type: sma Get Plugin or Get Source (stb.sma - 3 views - 2.7 KB)

Last edited by gfxchris; 02-22-2021 at 12:19.
gfxchris is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old 02-22-2021 , 12:24   Re: help me with this respawn plugin
Reply With Quote #7

read_data() is not a function which is to be used with Ham_* forwards, only for messages hooked using register_event() (perhaps others, not entierly sure).
Code:
public fwd_HamKilled(id, Victim, Attacker, Shouldgib) {     if(!get_pcvar_num(g_on))         return
    id = read_data(2)
    if(get_pcvar_num(g_res))     {
        set_task(get_pcvar_float(g_restime), "Respawning", id+TASK_RES);
    } }

Code:
public fwd_HamKilled(id, Victim, Attacker, Shouldgib) {     if(!get_pcvar_num(g_on))         return
    //id = read_data(2)
    if(get_pcvar_num(g_res))     {
        set_task(get_pcvar_float(g_restime), "Respawning", Victim+TASK_RES);
    } }
__________________

Last edited by Black Rose; 02-22-2021 at 12:29.
Black Rose is offline
gfxchris
Member
Join Date: Feb 2016
Old Today , 05:36   Re: help me with this respawn plugin
Reply With Quote #8

with the changes made below,the plugin works like this:
when i die,im not respawning automatically,i need to type /respawn (not how i wanted it to be)
when i kill somebody,it respawns me automatically instead
gfxchris is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Upplands Väsby, Sweden
Old Today , 05:48   Re: help me with this respawn plugin
Reply With Quote #9

Sorry. I missed this:
Code:
public fwd_HamKilled(id, Victim, Attacker, Shouldgib)
-->
Code:
public fwd_HamKilled(Victim, Attacker, Shouldgib) {
__________________
Black Rose is offline
Reply


Thread Tools
Display Modes

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 15:14.


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