AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   Solved [Request] Respawn (UP 6+ SECONDS) (https://forums.alliedmods.net/showthread.php?t=332637)

Percib4l 05-24-2021 06:07

[Request] Respawn (UP 6+ SECONDS)
 
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. :oops:

Celena Luna 05-24-2021 23:39

Re: [Request] Respawn (UP 6+ SECONDS)
 
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)



Percib4l 05-25-2021 12:12

Re: [Request] Respawn (UP 6+ SECONDS)
 
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)

Celena Luna 05-25-2021 22:31

Re: [Request] Respawn (UP 6+ SECONDS)
 
Quote:

Originally Posted by Percib4l (Post 2747790)
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

Percib4l 05-27-2021 18:07

Re: [Request] Respawn (UP 6+ SECONDS)
 
:shock: You are amazing, thanks for your help :3


All times are GMT -4. The time now is 19:59.

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