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

need help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Tez
New Member
Join Date: Apr 2016
Old 07-03-2016 , 11:21   need help
Reply With Quote #1

well hey guys,i started to code plugins for cs and i have a little problems with this code:
Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
CreateConVar;mp_warmup_start
CreateConVar;mp_warmup_end
public Plugin;myinfo =
{ name = "Tez's Warmup"description = "starting the warmup within a command."author = "Tez" };
public void OnPluginStart()
{
RegAdminCmd("sm_wms", Command_WMS, ADMFLAG_GENERIC, "Warmup will start in 1 second.") };
mp_warmup_start = FindConVar("mp_warmup_start");
RegAdminCmd("sm_wme", Command_WME, ADMFLAG_GENERIC, "Warmup will end in 1 second.")
mp_warmup_end = FindConVar("mp_warmup_end");
}
public Action Command_WMS(int client, int args)
{
mp_warmup_start.IntValue = 1;
PrintToChatAll(" \x04[SM]\x01 warmup will start in 1 second.");
return Plugin_Handled
}
public Action Command_WME(int client, int args)
{
mp_warmup_end.IntValue = 1; 
PrintToChatAll(" \x04[SM]\x01 Warmup will end in 1 second!")};
and i have these errors:
PHP Code:
include/sourcemod.inc(41) : error 110Plugin has already been defined (previously seen as enum)
plugin.sp(5) : error 001expected token";"but found "-label-"
plugin.sp(6) : error 001expected token";"but found "public"
plugin.sp(7) : error 001expected token";"but found "-identifier-"
plugin.sp(7) : error 010invalid function or declaration
plugin
.sp(10) : error 001expected token";"but found "}"
plugin.sp(10) : error 010invalid function or declaration
plugin
.sp(11) : error 008must be a constant expressionassumed zero
plugin
.sp(13) : error 008must be a constant expressionassumed zero
plugin
.sp(17) : error 104cannot find any methods for CreateConVar
plugin
.sp(17) : warning 213tag mismatch
plugin
.sp(20) : error 001expected token";"but found "}"
plugin.sp(23) : error 104cannot find any methods for CreateConVar
plugin
.sp(23) : warning 213tag mismatch
plugin
.sp(24) : error 001expected token";"but found "}"
plugin.sp(24) : error 010invalid function or declaration
plugin
.sp(7) : warning 203symbol is never used"author"
plugin.sp(7) : warning 203symbol is never used"description"
plugin.sp(23) : warning 204symbol is assigned a value that is never used"mp_warmup_end"
plugin.sp(17) : warning 204symbol is assigned a value that is never used"mp_warmup_start"
plugin.sp(7) : warning 203symbol is never used"myinfo" 
any help?ty
Tez is offline
nOProblem
New Member
Join Date: Mar 2016
Old 07-03-2016 , 16:20   Re: need help
Reply With Quote #2

PHP Code:
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo 
{
    
name "Tez's Warmup",
    
author "Tez"
    
description "starting the warmup within a command."
    
version "1.0"
    
url "https://www.sourcemod.net/"
};

public 
void OnPluginStart()
{
    
RegAdminCmd("sm_wms"Command_WMSADMFLAG_GENERIC"Warmup will start in 1 second.");
    
RegAdminCmd("sm_wme"Command_WMEADMFLAG_GENERIC"Warmup will end in 1 second.");
}

public 
Action Command_WMS(int clientint args)
{
    
CreateTimer(1.0WarmupStart);
    
PrintToChatAll(" \x04[SM]\x01 Warmup will start in 1 second.");
    
    return 
Plugin_Handled;
}

public 
Action Command_WME(int clientint args)
{
    
CreateTimer(1.0WarmupEnd);
    
PrintToChatAll(" \x04[SM]\x01 Warmup will end in 1 second!");
    
    return 
Plugin_Handled;
}

public 
Action WarmupStart(Handle timer)
{
    
ServerCommand("mp_warmup_start");
}

public 
Action WarmupEnd(Handle timer)
{
    
ServerCommand("mp_warmup_end");

This is just an example of how you could do it. Since the cvar´s "mp_round_start" and "mp_round_end" have no values, you can just use the function ServerCommand for it.

And next time, please use the [PHP] Tag to make the code more readable for us..
nOProblem 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 10:15.


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