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

[SOLVED]Help with SyncHud


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 11-01-2009 , 09:18   [SOLVED]Help with SyncHud
Reply With Quote #1

I have a problem with this, works all right, but in the countdown no,show an static hud,like ( " You Will Respawn in 3 seconds" )but dont show 2 - 1,etc....i dont know which is the problem :s

Here I leave the code ...

PHP Code:
//Global
new respawntimer
new delay

#define TASK_HUD    1437

//Init
respawntimer CreateHudSyncObj()
delay register_cvar("amx_respawn_delay","3.0")

//Task
set_task(1.0,"CmdHud",id+TASK_HUD,_,_,"b")

//Function
public CmdHud(id) { 
        
    
id -= TASK_HUD
    
new respawnsegs[33]
    
respawnsegs[id] = get_pcvar_num(delay)
    
    if(
respawnsegs[id] <= 0) {
        
remove_task(id+TASK_HUD)
        
chat_color(id,"!g%s!y Para deshabilitar tu respawn,tipea!team /respawn!y.",szPrefix)
    }
    
    else {
    
set_hudmessage(255255255, -1.00.7906.01.00.10.2)
    
ShowSyncHudMsg(id,respawntimer,"Respawnearas en %d segundo%s",respawnsegs[id],get_pcvar_num(delay) < "" "s")
    }
    
    
respawnsegs[id]--

Thanks! and sorry 4 my bad english

Last edited by #8 SickneSS; 11-01-2009 at 20:50.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 11-01-2009 , 10:38   Re: Help with SyncHud
Reply With Quote #2

Try this (not tested)

PHP Code:
// Global
new respawntimer[32]
new 
respawnsegs[32]
new 
delay

public plugin_init()
{
    
delay register_cvar("amx_respawn_delay""3.0")
}

//Function to Init timer
public respawnFunc(player)
{
    new 
param[1]
    
param[0] = player
    respawntimer
[player] = CreateHudSyncObj()
    
respawnsegs[player] = get_pcvar_num(delay)
    
set_task(1.0"CmdHud"player TASK_HUDparam_"b")
}

// Function CmdHud
public CmdHud(param[])
{        
    
player param[0]

    if(
respawnsegs[player] <= 0)
    {
        
remove_task(player TASK_HUD)
        
chat_color(player"!g%s!y Para deshabilitar tu respawn,tipea!team /respawn!y."szPrefix)
    }
    else
    {
        
set_hudmessage(255255255, -1.00.7906.01.00.10.2)
        
ShowSyncHudMsg(playerrespawntimer[player], "Respawnearas en %d segundo%s"respawnsegs[id], get_pcvar_num(delay) < "" "s")
    }
    
respawnsegs[id]--

Add your code to call respawnFunc with player id as a parameter.
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 11-01-2009 , 10:57   Re: Help with SyncHud
Reply With Quote #3

Thanks but dont works:/
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 11-01-2009 , 11:07   Re: Help with SyncHud
Reply With Quote #4

Quote:
Originally Posted by #8 SickneSS View Post
Thanks but dont works:/
Gives you an error?
What it does?
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 11-01-2009 , 11:26   Re: Help with SyncHud
Reply With Quote #5

Now,make all right,show " You Will Respawn in 3 seconds",and hide the hud after 3 seconds.

but dont make the countdown

like...

" You Will Respawn in 3 seconds"
" You Will Respawn in 2 seconds"
" You Will Respawn in 1 second"
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
joropito
AlliedModders Donor
Join Date: Mar 2009
Location: pfnAddToFullPack
Old 11-01-2009 , 12:04   Re: Help with SyncHud
Reply With Quote #6

Quote:
Originally Posted by #8 SickneSS View Post
Now,make all right,show " You Will Respawn in 3 seconds",and hide the hud after 3 seconds.

but dont make the countdown

like...

" You Will Respawn in 3 seconds"
" You Will Respawn in 2 seconds"
" You Will Respawn in 1 second"
Change this

PHP Code:
    respawnsegs[id]-- 
to this

PHP Code:
    respawnsegs[player]-- 
And change this

PHP Code:
 ShowSyncHudMsg(playerrespawntimer[player], "Respawnearas en %d segundo%s"respawnsegs[id], get_pcvar_num(delay) < "" "s"
to this

PHP Code:
 ShowSyncHudMsg(playerrespawntimer[player], "Respawnearas en %d segundo%s"respawnsegs[player], respawnsegs[player] < "" "s"
__________________

Divide et vinces
approved plugins | steam account

I don't accept PM for support. Just ask on forums.
If you're looking for private work, PM me.
joropito is offline
Send a message via MSN to joropito
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 11-01-2009 , 12:20   Re: Help with SyncHud
Reply With Quote #7

does the same
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Alucard^
AMXX Moderator: Others
Join Date: Sep 2007
Location: Street
Old 11-01-2009 , 15:00   Re: Help with SyncHud
Reply With Quote #8

Try this:

Code:
#include <amxmodx> #define PLUGIN    "New Plugin" #define AUTHOR    "Alucard" #define VERSION    "1.0" #define TASK_HUD    1437 new respawntimer new p_delay new iCountdown public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         respawntimer = CreateHudSyncObj()     p_delay = register_cvar("amx_respawn_delay","3")         iCountdown = get_pcvar_num(p_delay) } //Task set_task(1.0,"CmdHud",id+TASK_HUD) //Function public CmdHud(taskid) {     new id = taskid-TASK_HUD         if(iCountdown > 0)     {         set_hudmessage(255, 255, 255, -1.0, 0.79, 0, 6.0, 1.0, 0.1, 0.2)         ShowSyncHudMsg(id,respawntimer,"Respawnearas en %d segundo%s", iCountdown, iCountdown < 2 ? "" : "s")                 iCountdown--                 set_task(1.0,"CmdHud",id+TASK_HUD)     }     else     {         chat_color(id,"!g%s!y Para deshabilitar tu respawn,tipea!team /respawn!y.",szPrefix)     } }
__________________
Approved Plugins - Steam Profile

Public non-terminated projects:
All Admins Menu, HLTV parameters, Subnick,
Second Password (cool style), InfoZone,
Binary C4 plant/defuse, and more...

Private projects:
NoSpec (+menu), NV Surf Management,
PM Adanved System, KZ longjump2, and more...

Last edited by Alucard^; 11-01-2009 at 15:04.
Alucard^ is offline
Send a message via Skype™ to Alucard^
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 11-01-2009 , 16:00   Re: Help with SyncHud
Reply With Quote #9

does the same
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
matsi
Thinkosaur
Join Date: Sep 2006
Old 11-01-2009 , 17:40   Re: Help with SyncHud
Reply With Quote #10

Quote:
Originally Posted by #8 SickneSS View Post
does the same
Here:
Code:
#include <amxmodx> #include <amxmisc> #define task_id    1445 new g_iCounter new g_HudSyncObj new p_delay public plugin_init() {     register_plugin( "respawn", "1.0", "matsi")     register_clcmd( "say /respawn", "cmd_respawn" )         p_delay = register_cvar( "amx_respawn_delay", "3" ) } public plugin_cfg() {     g_HudSyncObj = CreateHudSyncObj() } public cmd_respawn( id ) {     if( task_exists( task_id ) )         remove_task( task_id )         g_iCounter = get_pcvar_num( p_delay )         set_task( 1.0, "start_countdown", task_id, _, _, "b" )         return PLUGIN_HANDLED } public start_countdown( id ) {     if( !g_iCounter ) //time is up     {         remove_task( task_id )         set_hudmessage( 255, 255, 255, -1.0, 0.79, 0, 6.0, 1.0, 0.1, 0.2, -1 )         ShowSyncHudMsg( 0, g_HudSyncObj, "You have been respawned" )         //set player to respawn here         return     }         set_hudmessage( 255, 255, 255, -1.0, 0.79, 0, 6.0, 1.0, 0.1, 0.2, -1 )     ShowSyncHudMsg( 0, g_HudSyncObj, "You will respawn in %i second%s", g_iCounter, g_iCounter < 2 ? "" : "s" )         g_iCounter-- }

I didn't really understand what you were doing but this is what i came up with.
matsi 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 06:00.


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