Raised This Month: $51 Target: $400
 12% 

Solved [Request] Respawn (UP 6+ SECONDS)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Percib4l
Junior Member
Join Date: May 2021
Old 05-24-2021 , 06:07   [Request] Respawn (UP 6+ SECONDS)
Reply With Quote #1

I'm not an amxx programmer and soon im starting to study it, I just want a plugin to play with my friends for a while.

I would like a respawn, but not the classic one that simply when you die you reappear after 3 seconds, what I would like is that when dying if you need to wait 6 seconds to reappear "the first time", then add 6 more seconds, that is:

1.-Respawn 6 SEC

2.-Respawn 12 SEC

3.-Respawn 18 SEC

Etc, without limits of these respawn, please if someone can do it, I thank you in advance.

Last edited by Percib4l; 08-30-2021 at 19:20.
Percib4l is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-24-2021 , 23:39   Re: [Request] Respawn (UP 6+ SECONDS)
Reply With Quote #2

I haven't test but it should work
I make it so it reset at every new round

PHP Code:
/* Sublime AMXX Editor v2.2 */

#include <amxmodx>
// #include <amxmisc>
// #include <cstrike>
// #include <engine>
// #include <fakemeta>
#include <hamsandwich>
// #include <fun>
// #include <xs>
// #include <sqlx>

#define PLUGIN  "Respawn"
#define VERSION "1.0"
#define AUTHOR  "Celena Luna"

new DeadCount[33]

#define TASK_SPAWN 10000

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
RegisterHam(Ham_Killed"player""OnKilled")
    
register_event("HLTV""event_new_round""a""1=0""2=0"
}

public 
client_disconnect(id
{
    if(
task_exists(id+TASK_SPAWN))
        
remove_task(id+TASK_SPAWN)
}

public 
event_new_round()
{
    for(new 
isizeof(DeadCount); i++)
        
DeadCount[i] = 0
}

public 
OnKilled(idattackershouldgib)
{
    
DeadCount[id] += 1
    client_print
(idprint_center"You will respawn after [%i] seconds"floatround(DeadCount[id]*6.0))
    
set_task(DeadCount[id]*6.0"Respawn"id+TASK_SPAWN)
}

public 
Respawn(taskid)
{
    new 
id taskid TASK_SPAWN
    ExecuteHamB
(Ham_CS_RoundRespawnid)

__________________
My plugin:

Last edited by Celena Luna; 05-24-2021 at 23:39.
Celena Luna is offline
Percib4l
Junior Member
Join Date: May 2021
Old 05-25-2021 , 12:12   Re: [Request] Respawn (UP 6+ SECONDS)
Reply With Quote #3

Thank you, its working.

If I want to add more time instead of "6" I should change it here right?
PHP Code:
 DeadCount[id] += 1
    client_print
(idprint_center"You will respawn after [%i] seconds"floatround(DeadCount[id]*6.0))
    
set_task(DeadCount[id]*6.0"Respawn"id+TASK_SPAWN
And how can I add a hud with a counter regressive respawn. (Sorry if I ask too much)
Percib4l is offline
Celena Luna
Veteran Member
Join Date: Aug 2013
Location: Nagazora
Old 05-25-2021 , 22:31   Re: [Request] Respawn (UP 6+ SECONDS)
Reply With Quote #4

Quote:
Originally Posted by Percib4l View Post
Thank you, its working.

If I want to add more time instead of "6" I should change it here right?
PHP Code:
 DeadCount[id] += 1
    client_print
(idprint_center"You will respawn after [%i] seconds"floatround(DeadCount[id]*6.0))
    
set_task(DeadCount[id]*6.0"Respawn"id+TASK_SPAWN
And how can I add a hud with a counter regressive respawn. (Sorry if I ask too much)
OK so I made a small modification
1. You can change the respawn time multiply by changing SPAWN DELAY
Code:
#define SPAWN_DELAY 6 //Change this

2. Adding the Hud Message
3. Fix the bug where player still in respawn state (the timer still counting down and will respawn after that) event after starting a new round

Full Code
Spoiler
__________________
My plugin:
Celena Luna is offline
Percib4l
Junior Member
Join Date: May 2021
Old 05-27-2021 , 18:07   Re: [Request] Respawn (UP 6+ SECONDS)
Reply With Quote #5

You are amazing, thanks for your help
Percib4l 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 02:29.


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