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

[CSGO]What command can only let the plugin only run 1 time?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chancsomy
Junior Member
Join Date: Sep 2013
Old 02-11-2015 , 09:21   [CSGO]What command can only let the plugin only run 1 time?
Reply With Quote #1

i am scripting a knife round plugin.but once i activate this plugin . no matter it is a knife round or normal round. it says knife round start....
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

public OnPluginStart()
{
    
RegAdminCmd("sm_knife"knifeADMFLAG_SLAY"knife round");
}

public 
Action:knife(clientargs)
{
    
ServerCommand("exec knife.cfg");
    
PrintToChatAll("[\x05HKG\x01] \x04knife round begins in 10 seconds");
    
HookEvent("round_start"Event_RoundStart);
    
HookEvent("round_end"Event_RoundEnd);
}

public 
Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
PrintToChatAll("[\x05HKG\x01] \x04knife round starts!");
    return;
}

public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
    if(
GetTeamScore(CS_TEAM_T) == 1){
        
PrintToChatAll("[\x05HKG\x01] \x04T WON");
        return;
    }
    else{
        
PrintToChatAll("[\x05HKG\x01] \x04CT WON");
        return;
    }

btw.sorry for my bad english hope u guys can know what i am saying

Last edited by chancsomy; 02-11-2015 at 09:25.
chancsomy is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 02-11-2015 , 09:29   Re: [CSGO]What command can only let the plugin only run 1 time?
Reply With Quote #2

You can just unhook the events like this:

PHP Code:
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast

    
PrintToChatAll("[\x05HKG\x01] \x04knife round starts!");
    
    
UnhookEvent"round_start"Event_RoundStart );
    
    return;


public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast

    
UnhookEvent"round_end"Event_RoundEnd );
    
    if(
GetTeamScore(CS_TEAM_T) == 1){ 
        
PrintToChatAll("[\x05HKG\x01] \x04T WON"); 
        return; 
    } 
    else{ 
        
PrintToChatAll("[\x05HKG\x01] \x04CT WON"); 
        return; 
    }

Mehis is offline
chancsomy
Junior Member
Join Date: Sep 2013
Old 02-11-2015 , 09:34   Re: [CSGO]What command can only let the plugin only run 1 time?
Reply With Quote #3

Quote:
Originally Posted by Mehis View Post
You can just unhook the events like this:

PHP Code:
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast

    
PrintToChatAll("[\x05HKG\x01] \x04knife round starts!");
    
    
UnhookEvent"round_start"Event_RoundStart );
    
    return;


public 
Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast

    
UnhookEvent"round_end"Event_RoundEnd );
    
    if(
GetTeamScore(CS_TEAM_T) == 1){ 
        
PrintToChatAll("[\x05HKG\x01] \x04T WON"); 
        return; 
    } 
    else{ 
        
PrintToChatAll("[\x05HKG\x01] \x04CT WON"); 
        return; 
    }

It works !!!! THANK YOU A LOT!!!!!!

2 More questions , which command that i can get the round ?
for example i want to make this

PrintToChatAll("[SM] xx Round Started! ");

and after finish the knife round . i want the winner can type !stay / !swap to select the starting side. but how can i only allow this command for winner ?

ty once again

Last edited by chancsomy; 02-11-2015 at 10:40.
chancsomy is offline
Reply


Thread Tools
Display Modes

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 04:05.


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