AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Special clcmd with rounds support (https://forums.alliedmods.net/showthread.php?t=121781)

KadiR 03-19-2010 19:09

Special clcmd with rounds support
 
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!

fysiks 03-19-2010 19:12

Re: Special clcmd with rounds support
 
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.

Seta00 03-19-2010 19:15

Re: Special clcmd with rounds support
 
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;



KadiR 03-19-2010 19:16

Re: Special clcmd with rounds support
 
Quote:

Originally Posted by fysiks (Post 1122830)
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..

fysiks 03-19-2010 19:17

Re: Special clcmd with rounds support
 
Quote:

Originally Posted by KadiR (Post 1122838)
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.

KadiR 03-19-2010 19:20

Re: Special clcmd with rounds support
 
Quote:

Originally Posted by fysiks (Post 1122840)
Your request as nothing to do with Cvars.

My question was, how to get the round thing to work..

Seta00 03-19-2010 19:22

Re: Special clcmd with rounds support
 
I've edited my first post. Check it again.

KadiR 03-19-2010 19:48

Re: Special clcmd with rounds support
 
Quote:

Originally Posted by Seta00 (Post 1122845)
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!

wrecked_ 03-19-2010 19:51

Re: Special clcmd with rounds support
 
PHP Code:

client_print(idprint_chat"Wait %d rounds to use cmd again."get_pcvar_numCvCmdDuration ) - roundsLeft); 


Doc-Holiday 03-20-2010 00:40

Re: Special clcmd with rounds support
 
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.


All times are GMT -4. The time now is 08:35.

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