Raised This Month: $ Target: $400
 0% 

Special clcmd with rounds support


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 03-19-2010 , 19:09   Special clcmd with rounds support
Reply With Quote #1

Can someone show me, how that I can make a register_clcmd to be usable after some rounds. Like:

Round 1:

clcmd got typed and it's active!

Round 2:

clcmd got typed, wait x rounds to use it!

Round 3:

clcmd got typed wait x rounds to use it!

Round 4:

clcmd got typed and it's active!
KadiR is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-19-2010 , 19:12   Re: Special clcmd with rounds support
Reply With Quote #2

I'm sure there are several ways to acheive this. However, you need to be more specific about when the command becomes active again. In your example it is only active on the first and fourth rounds. Extrapolating from that it would be active on the 7th and 10th rounds also.

So, be more specific if it's not literally the 1st, 4th, 7th, and 10th rounds.
__________________
fysiks is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-19-2010 , 19:15   Re: Special clcmd with rounds support
Reply With Quote #3

Check out my Ski2 Shop plugin (link in the sig), I've used round count to implement items that last for more than one round.

EDIT: Or use this:
PHP Code:
#include <amxmodx>

new RoundCountCvCmdDuration;

public 
plugin_init() {
    
register_logevent("logevent_RoundStart"2"1=Round_Start");
    
register_clcmd("myclcmd""clcmd_handler");
    
CvCmdDuration register_cvar("amx_cmdduration""3");
}

public 
logevent_RoundStart() {
    
RoundCount++;
}

public 
clcmd_handler(id) {
    new 
roundsLeft RoundCount get_pcvar_num(CvCmdDuration);
    
    if (
roundsLeft != 0) {
        
client_print(idprint_chat"Wait %d rounds to use cmd again."get_pcvar_num(CvCmdDuration) - roundsLeft);
        return 
PLUGIN_HANDLED;
    }
    
    
// your code goes here
    
    
return PLUGIN_HANDLED;


Last edited by Seta00; 03-19-2010 at 20:35.
Seta00 is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 03-19-2010 , 19:16   Re: Special clcmd with rounds support
Reply With Quote #4

Quote:
Originally Posted by fysiks View Post
I'm sure there are several ways to acheive this. However, you need to be more specific about when the command becomes active again. In your example it is only active on the first and fourth rounds. Extrapolating from that it would be active on the 7th and 10th rounds also.

So, be more specific if it's not literally the 1st, 4th, 7th, and 10th rounds.
Well, I meant to use it with a cvar like, it should be active after x rounds passed.

@ Seta: I will try..
KadiR is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 03-19-2010 , 19:17   Re: Special clcmd with rounds support
Reply With Quote #5

Quote:
Originally Posted by KadiR View Post
Well, I meant to use it with a cvar like, it should be active after x rounds passed.
Your request as nothing to do with Cvars.
__________________
fysiks is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 03-19-2010 , 19:20   Re: Special clcmd with rounds support
Reply With Quote #6

Quote:
Originally Posted by fysiks View Post
Your request as nothing to do with Cvars.
My question was, how to get the round thing to work..
KadiR is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-19-2010 , 19:22   Re: Special clcmd with rounds support
Reply With Quote #7

I've edited my first post. Check it again.
Seta00 is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 03-19-2010 , 19:48   Re: Special clcmd with rounds support
Reply With Quote #8

Quote:
Originally Posted by Seta00 View Post
I've edited my first post. Check it again.
Thanks works perfectly, but there is a small fault with the round count, I made for testing amx_cmdduration", "3", and it did print on round start:

Wait 1 rounds!

2. Round:

Wait 2 rounds!

3. Round:

clcmd active!
KadiR is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 03-19-2010 , 19:51   Re: Special clcmd with rounds support
Reply With Quote #9

PHP Code:
client_print(idprint_chat"Wait %d rounds to use cmd again."get_pcvar_numCvCmdDuration ) - roundsLeft); 
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 03-20-2010 , 00:40   Re: Special clcmd with rounds support
Reply With Quote #10

wouldnt it be better to set the round count to one and then ++roundcount on round end since roundstart isnt called till after the freeze time that way it always works reguardless if the freeze time is up or not.
Doc-Holiday 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 08:35.


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