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

Timeleft as Roundtime


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Plugin Info:     Modification:   ALL        Category:   Gameplay       
AcidoX
Senior Member
Join Date: Oct 2007
Location: Vilnius
Old 06-07-2009 , 08:11   Timeleft as Roundtime
#1

Description
This small plugin shows timeleft as roundtime, specified for CSDM & other mods where you dont need roundtime.

Changelog
1.0 first release
1.1 Code rewritten
1.2 Added FCVAR, fixed the code

Credits
joaquimandrade
arkshine
Attached Files
File Type: sma Get Plugin or Get Source (TimeleftRoundtime.sma - 2181 views - 714 Bytes)
__________________
Who need lockerz invite? Pm me.

Last edited by AcidoX; 06-08-2009 at 17:53.
AcidoX is offline
Send a message via Skype™ to AcidoX
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-07-2009 , 08:30   Re: Timeleft as Roundtime
#2

It can't work... Did you test your plugin at last ?!
__________________
Arkshine is offline
AcidoX
Senior Member
Join Date: Oct 2007
Location: Vilnius
Old 06-07-2009 , 08:33   Re: Timeleft as Roundtime
#3

No i didnt, but it complited without errors, im now not on my PC, i dont have CS to test it...
__________________
Who need lockerz invite? Pm me.
AcidoX is offline
Send a message via Skype™ to AcidoX
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-07-2009 , 08:42   Re: Timeleft as Roundtime
#4

Try to figure out why.

You create severals tasks with the same id, plus, you loop through 'num' which doesn't hold any value ( 0 ), and players[] is empty too... You forget to retrieve the players... Why did you release something that you don't know if it works as expected or not... Really I don't understand that.

A working code based on your code ( you can reduce using register_message() Edit : Like joaquimandrade's code below ):

Code:
#include <amxmodx> const MAX_CLIENTS = 32; new gMsgidRoundTime; public plugin_init() {     register_plugin( "Timeleft as Roundtime", "AcidoX" , "1.0" );         gMsgidRoundTime = get_user_msgid( "RoundTime" );     set_task( 1.0, "UpdateTimer", .flags = "b" ); } public UpdateTimer() {     static Players[ MAX_CLIENTS ];     static Num;     static i;         get_players( Players, Num );     for ( i = 0; i < Num; i++ )     {         message_begin( MSG_ONE_UNRELIABLE, gMsgidRoundTime, .player = Players[ i ] );         write_short( get_timeleft() );         message_end();     } }
__________________

Last edited by Arkshine; 06-07-2009 at 12:57.
Arkshine is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-07-2009 , 12:39   Re: Timeleft as Roundtime
#5

PHP Code:
#include <amxmodx> 

public plugin_init() 

    
register_plugin"Timeleft as Roundtime""AcidoX" "1.0" );
    
register_message(get_user_msgid("RoundTime"),"msgRoundTime")
}

public 
msgRoundTime(msgidmsgDestmsgEnt)
{
    
set_msg_arg_int(1,ARG_SHORT,get_timeleft());

__________________
joaquimandrade is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-07-2009 , 13:00   Re: Timeleft as Roundtime
#6

@joaquimandrade : Better to use register_message() or FM_WriteShort forward ?
__________________
Arkshine is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 06-07-2009 , 13:06   Re: Timeleft as Roundtime
#7

Quote:
Originally Posted by arkshine View Post
@joaquimandrade : Better to use register_message() or FM_WriteShort forward ?
I never saw WriteShort.

About the plugin, it seems that RoundTime is only sent when the round start and then the clients do the calculations so, there isn't the need of having a loop at all. I tested the code I've posted and it works but the counter disappear after the bomb being planted.
__________________

Last edited by joaquimandrade; 06-07-2009 at 13:10. Reason: Correct: doesn't disappear -> disappear
joaquimandrade is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-07-2009 , 13:25   Re: Timeleft as Roundtime
#8

PHP Code:
set_task1.0"UpdateTimer", .flags "b" ); 
Wtf? Someone can say how he placed .flags = there and it worked o_O
__________________
xPaw is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 06-07-2009 , 13:29   Re: Timeleft as Roundtime
#9

Instead of writing _, _, _, you say explicitly you want to modify this param ( flags being the label name in the function header ) so you don't need to specify the others. ( tip by Joaquim but he has probably seen that on Sawce's plugin. )

eg : set_task( .function="CheckActiveHives", .time=4.0, .flags="b"); or set_task .function="CheckActiveHives", .time=4.0, .flags="b";
__________________

Last edited by Arkshine; 06-07-2009 at 13:39.
Arkshine is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 06-07-2009 , 13:38   Re: Timeleft as Roundtime
#10

Ah so for example i can have like

PHP Code:
Blubbidparam1param2param3param4param5 );

Blubbid, .param3 1, .param5 ); 
__________________
xPaw is offline
Closed Thread



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 03:25.


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