Raised This Month: $ Target: $400
 0% 

Catching 10sec beginning of the round


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 10-25-2009 , 05:47   Catching 10sec beginning of the round
Reply With Quote #1

I want to add an option, that if player type '' hi '' , cmdSayHI opens, but only if max 10sec, so:

Round starts, I type '' hi '' cmdSayHI begins, but if 10seconds are passed in the round and I try to type '' hi '' it says in chat to the user: 10 seconds already passed!

It should be this function with this '' 10 seconds '' option.

PHP Code:
register_clcmd("say HI""cmdSayHI"); 
KadiR is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 10-25-2009 , 07:23   Re: Catching 10sec beginning of the round
Reply With Quote #2

you could get the time @ start round + mp_freezetime - gametime = the_diffrent

if the_diffrent > 10 , then block the say cmd. but i dont know how you can block the say cmd .
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 10-25-2009 , 08:18   Re: Catching 10sec beginning of the round
Reply With Quote #3

here some code:
PHP Code:
#include <amxmodx>
#include <hamsandwich>

new g_user_time[33]

public 
plugin_init(){
    
RegisterHam(Ham_Spawn"player""player_spawn"1)
    
register_clcmd("say hi""cmdSayHI")
}

public 
client_connect(id)
    
g_user_time[id] = 0
    
public player_spawn(id)
    if(
is_user_alive(id) && g_user_time[id] <= 0)
        
g_user_time[id] = get_systime()

public 
cmdSayHI(id){
    if(
g_user_time[id] <= 0){
        
//user has not been spawned yet since connect
        
return PLUGIN_CONTINUE
    
}
    if(
get_systime() - g_user_time[id] > 10){
        
//at least 10 seconds passed since user first spawn
        
client_print(idprint_chat"10 seconds already passed.")
        return 
PLUGIN_HANDLED
    
}

    
//user has been spawned and 10 seconds have not passed yet

    
return PLUGIN_CONTINUE

__________________
Impossible is Nothing
Sylwester is offline
KadiR
Unnecessary Member
Join Date: Aug 2008
Location: Zürich / Switzerland
Old 03-19-2010 , 19:07   Re: Catching 10sec beginning of the round
Reply With Quote #4

Tried and I think it isn't that what I wanted.

PHP Code:
//at least 10 seconds passed since user first spawn 
Well I want it, everytime if the round, so at least 10 seconds passed since user spawned in a round.
KadiR is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-19-2010 , 19:11   Re: Catching 10sec beginning of the round
Reply With Quote #5

PHP Code:
#include <amxmodx>

new bool:tenSecs;

public 
plugin_init() {
    
register_clcmd("say hi""cmdSayHi");
    
register_logevent("logevent_RoundStart"2"1=Round_Start");
}

public 
logevent_RoundStart() {
    
tenSecs false;
    
set_task(10.0"tenSecsPassed");
}

public 
tenSecsPassed() {
    
tenSecs true;
}

public 
cmdSayHi(id) {
    if (
tenSecs) {
        
client_print(idprint_chat"10 seconds already passed.");
        return 
PLUGIN_HANDLED;
    }
    
    
// your code goes here
    
    
return PLUGIN_HANDLED;

Seta00 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 17:32.


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