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

my plugin crash


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Johnoclock
Member
Join Date: Oct 2014
Location: denmark
Old 07-28-2015 , 07:58   my plugin crash
Reply With Quote #1

my plugin is crashing cooldown on mapchange idk what is worng but maybe you guy can help my
PHP Code:
#include <sourcemod>  
#include <sdktools>  
#include <tf2>  
#include <morecolors> 
#include <autoexecconfig>

#define PLUGIN_VERSION "3.0"  

new Handle:g_hPluginEnabled INVALID_HANDLE;
new 
bool:g_bPluginEnabled;

new 
Handle:g_hCoolDown INVALID_HANDLE;
new 
g_iCoolDown;

new 
Handle:g_hSpeedBoostTime INVALID_HANDLE;
new 
Float:g_fSpeedBoostTime;

new 
g_iTime;
    
new 
bool:canUseSpeedBoost[MAXPLAYERS+1] = {true, ...}; 

public 
Plugin myinfo =   
{  
    
name "[TF2] Call",  
    
author "John",  
    
description "Medic call for speed",  
    
version PLUGIN_VERSION,  
    
url " http://www.sourcemod.net"  
};

public 
OnPluginStart() 
{
    
AutoExecConfig_SetFile("sm_call");
    
AutoExecConfig_SetCreateFile(true);
    
    
AutoExecConfig_CreateConVar("sm_call_version"PLUGIN_VERSION"TF2 Call Plugin Version"FCVAR_PLUGIN|FCVAR_DONTRECORD|FCVAR_NOTIFY);
    
    
g_hPluginEnabled AutoExecConfig_CreateConVar("sm_call_enable""1""Enables and disables the tf2 call plugin"FCVAR_NOTIFYtrue0.0true1.0);
    
HookConVarChange(g_hPluginEnabledOnCVarChange);
    
g_bPluginEnabled GetConVarBool(g_hPluginEnabled);
    
    
g_hCoolDown AutoExecConfig_CreateConVar("sm_call_cooldown_time""60.0""URL to validate"FCVAR_NOTIFY);
    
HookConVarChange(g_hCoolDownOnCVarChange);
    
g_iCoolDown GetConVarInt(g_hCoolDown);
    
    
g_hSpeedBoostTime AutoExecConfig_CreateConVar("sm_call_speedboost_time""5.0""Ammount of time the speedboost lasts"FCVAR_NOTIFY);
    
HookConVarChange(g_hSpeedBoostTimeOnCVarChange);
    
g_fSpeedBoostTime GetConVarFloat(g_hSpeedBoostTime);
    
    
AddCommandListener(MedicCall"voicemenu"); 
}

public 
OnCVarChange(Handle:hCVar, const String:sOldValue[], const String:sNewValue[])
{
    if(
hCVar == g_hPluginEnabled)
    {
        
g_bPluginEnabled GetConVarBool(g_hPluginEnabled);
    }
    if(
hCVar == g_hCoolDown)
    {
        
g_iCoolDown GetConVarInt(g_hCoolDown);
    }
    if(
hCVar == g_hSpeedBoostTime)
    {
        
g_fSpeedBoostTime GetConVarFloat(g_hSpeedBoostTime);
    }
}

public 
Action:MedicCall(clientString:command[], args)  
{
    if (!
g_bPluginEnabled)
    {
        
PrintToChat(client"\x04[Speed boost] \x01The TF2 Call plugin is disabled!");
         return 
Plugin_Handled;

    }
    if (!
canUseSpeedBoost[client])
    {
        
PrintToChat(client"\x04[Speed boost] \x01You have \x03%i\x01 seconds left of the cooldown !"g_iTime)


       
    }

    
decl String:sBuffer[2];

    
GetCmdArg(1sBuffersizeof(sBuffer));

    if (
StringToInt(sBuffer) == 0)
    {
        
GetCmdArg(2sBuffersizeof(sBuffer));
        if (
StringToInt(sBuffer) == 0)
        {
            if(
canUseSpeedBoost[client] == true
            {
                
TF2_AddCondition(clientTFCond_SpeedBuffAllyg_fSpeedBoostTime);  
         
                
canUseSpeedBoost[client] = false;
                
                
g_iTime g_iCoolDown;
                
                
CreateTimer(1.0Timer_CoolDownclientTIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); 
            }
        } 
    }
}

public 
Action:Timer_CoolDown(Handle:hTimerany:client)
{
    if (
g_iTime == 0)
    {
        
canUseSpeedBoost[client] = true;
        return 
Plugin_Stop;
    }
    
g_iTime--;
    return 
Plugin_Continue;

Johnoclock 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 11:10.


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