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

You will be respawned after %s seconds.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-07-2017 , 06:47   You will be respawned after %s seconds.
Reply With Quote #1

Like the title said, when you died you should be revived after 15 sec for example with hud countdown message.
__________________
Ayman Khaled is offline
tarsisd2
Veteran Member
Join Date: Feb 2016
Location: brazil
Old 07-08-2017 , 13:05   Re: You will be respawned after %s seconds.
Reply With Quote #2

Something like this

PHP Code:
#include <amxmodx> 
#include <hamsandwich> 
#include <cstrike> 

#define PLUGIN "New Plugin" 
#define VERSION "1.0" 
#define AUTHOR "Author" 

#define TIMER_TASK        654321 
#define RESPAWN_TASK      098765 

new g_counter[33
new 
g_respawn  
new g_SyncRespawnTimer 

public plugin_init() 

    
register_plugin(PLUGINVERSIONAUTHOR
     
    
RegisterHam(Ham_Spawn"player""Spawn"1
    
RegisterHam(Ham_Killed"player""Killed"1
    
register_event"TeamInfo""JoinTeam""a"
     
    
g_respawn register_cvar("amx_respawn_time","15")  
     
    
g_SyncRespawnTimer CreateHudSyncObj() 


public 
JoinTeam()  

    new 
Client read_data(1
    static 
user_team[32
     
    
read_data(2user_team31
     
    if(!
is_user_connected(Client)) 
        return 
PLUGIN_HANDLED 
     
    
switch(user_team[0]) 
    { 
        case 
'C'set_task(1.0,"TimeCounter",Client TIMER_TASK,_,_,"a",get_pcvar_num(g_respawn)) 
             
        case 
'T'set_task(1.0,"TimeCounter",Client TIMER_TASK,_,_,"a",get_pcvar_num(g_respawn)) 
             
        case 
'S':  
        { 
            if(
task_exists(Client TIMER_TASK)) 
            { 
                
remove_task(Client TIMER_TASK
                
g_counter[Client] = 
            
}  
        } 
    } 
    return 
PLUGIN_HANDLED 


public 
Spawn(Client

    if (
is_user_alive(Client)) 
        
remove_task(Client TIMER_TASK
        
g_counter[Client] = 
   


public 
Respawn(Client

    
Client -= RESPAWN_TASK 
    
if (!is_user_alive(Client) && is_user_connected(Client)) 
        if( 
cs_get_user_team(Client) != CS_TEAM_SPECTATOR 
            
ExecuteHamB(Ham_CS_RoundRespawnClient


public 
Killed(Client

    if(
get_pcvar_num(g_respawn) != 0
    { 
        
set_task(1.0,"TimeCounter",Client TIMER_TASK,_,_,"a",get_pcvar_num(g_respawn)) 
    } 


public 
TimeCounter(Client)  

    
Client -= TIMER_TASK 
    g_counter
[Client]++ 
     
    new 
Float:iRespawnTime get_pcvar_float(g_respawn) - g_counter[Client
    new 
Float:fSec 
    fSec 
iRespawnTime  
     
    set_hudmessage
random_num(0,255), random_num(0,255), random_num(0,255), -1.00.25__1.0__, -1
    
ShowSyncHudMsgClientg_SyncRespawnTimer"You will be Respawned In %f Seconds"floatroundfSec ) ) 
     
    if(
g_counter[Client] == get_pcvar_num(g_respawn)) 
    { 
        
set_task(0.1"Respawn"Client RESPAWN_TASK
        
g_counter[Client] = 
    


tarsisd2 is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-08-2017 , 15:45   Re: You will be respawned after %s seconds.
Reply With Quote #3

works but...
You will be respawned in 0.00000000000 seconds
__________________

Last edited by Ayman Khaled; 07-08-2017 at 15:45.
Ayman Khaled is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-08-2017 , 18:19   Re: You will be respawned after %s seconds.
Reply With Quote #4

%d
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
Ayman Khaled
Senior Member
Join Date: Mar 2017
Location: Palestine
Old 07-09-2017 , 04:39   Re: You will be respawned after %s seconds.
Reply With Quote #5

Quote:
Originally Posted by EFFx View Post
%d
Thanks it works
but what different between %s, %d, %f, etc..
because i don't understand yet...
__________________
Ayman Khaled is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 07-09-2017 , 11:59   Re: You will be respawned after %s seconds.
Reply With Quote #6

https://forums.alliedmods.net/showthread.php?t=216827

Check #5 and #6 replies

Or more detailed - http://www.cplusplus.com/reference/cstdio/fprintf/
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 07-09-2017 at 12:02.
EFFx is offline
blanko
Senior Member
Join Date: Aug 2008
Old 07-13-2017 , 21:48   Re: You will be respawned after %s seconds.
Reply With Quote #7

Any way to print something fixed for everyone to see who's alive and/or dead?
__________________
blanko is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 07-13-2017 , 21:57   Re: You will be respawned after %s seconds.
Reply With Quote #8

Quote:
Originally Posted by blanko View Post
Any way to print something fixed for everyone to see who's alive and/or dead?
Please start your own thread since your question is unrelated to this thread. When you do post, you'll need to better explain what you are asking because your current description doesn't make much sense.
__________________

Last edited by fysiks; 07-13-2017 at 22:01.
fysiks is offline
blanko
Senior Member
Join Date: Aug 2008
Old 07-13-2017 , 23:28   Re: You will be respawned after %s seconds.
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Please start your own thread since your question is unrelated to this thread. When you do post, you'll need to better explain what you are asking because your current description doesn't make much sense.
A msg print to all players letting them know when someone respawns.
__________________
blanko 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 19:52.


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