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

Fixing errors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ItsExTacY
Member
Join Date: Jul 2017
Location: Israel
Old 08-10-2017 , 08:42   Fixing errors
Reply With Quote #1

I just make a plugin that move player to spectate by use !spec <TARGET>
PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Stylish"
#define PLUGIN_VERSION "1.0"

#include <cstrike>
#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Spectate"
    
author PLUGIN_AUTHOR
    
description "Move player to spectate"
    
version PLUGIN_VERSION
    
url ""
};

#define CMD_PREFIX "[SM] "

public void OnPluginStart()
{
    
RegAdminCmd("sm_spec"CMD_SpecADMFLAG_KICK"Set player to spectator");
}

public 
Action:CMD_Spec(int clientint args//Move the player to spectators
{
    if (!
IsClientValid(client) || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }
    
    if (
args != 1)
    {
        
ReplyToCommand(client"Usage: sm_spec <target>");
        return 
Plugin_Handled;
    }
    
    new 
String:target_string[65];
    
GetCmdArg(1target_stringsizeof(target_string));
    
    new 
String:target_name[MAX_TARGET_LENGTH], 
    
target_list[MAXPLAYERS], 
    
bool:tn_is_ml
    
target_count;
    
    if ((
target_count ProcessTargetString(target_stringclienttarget_listMAXPLAYERSCOMMAND_FILTER_CONNECTEDtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }
    
    for (new 
0target_counti++)
    {
        
ChangeClientTeam(target_list[i], CS_TEAM_SPECTATOR);
    }
    return 
Plugin_Handled;
}


bool:IsClientValid(client)
{
    return ((
client 0) && (client <= MaxClients));

But i still gettig those errors
Code:
sm_spec.sp
E:\******************\Plugins\sm_spec.sp(30) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(43) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(46) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(49) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(57) : error 147: new-style declarations are required
E:\******************\Plugins\sm_spec.sp(65) : error 147: new-style declarations are required
Done
Can someone help me fixing them?

Last edited by ItsExTacY; 08-10-2017 at 08:43.
ItsExTacY is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-10-2017 , 08:54   Re: Fixing errors
Reply With Quote #2

revmoe #pragma newdecls required
8guawong is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 08-10-2017 , 08:55   Re: Fixing errors
Reply With Quote #3

You're mixing old syntax with new syntax.

PHP Code:
#pragma semicolon 1

#define DEBUG

#define PLUGIN_AUTHOR "Stylish"
#define PLUGIN_VERSION "1.0"

#include <cstrike>
#include <sourcemod>
#include <sdktools>

#pragma newdecls required

public Plugin myinfo 
{
    
name "Spectate"
    
author PLUGIN_AUTHOR
    
description "Move player to spectate"
    
version PLUGIN_VERSION
    
url ""
};

#define CMD_PREFIX "[SM] "

public void OnPluginStart()
{
    
RegAdminCmd("sm_spec"CMD_SpecADMFLAG_KICK"Set player to spectator");
}

public 
Action CMD_Spec(int clientint args//Move the player to spectators
{
    if (!
IsClientValid(client) || !IsClientInGame(client))
    {
        return 
Plugin_Handled;
    }
    
    if (
args != 1)
    {
        
ReplyToCommand(client"Usage: sm_spec <target>");
        return 
Plugin_Handled;
    }
    
    
char target_string[65];
    
GetCmdArg(1target_stringsizeof(target_string));
    
    
char target_name[MAX_TARGET_LENGTH];
    
int target_list[MAXPLAYERS];
    
bool tn_is_ml;
    
int target_count;
    
    if ((
target_count ProcessTargetString(target_stringclienttarget_listMAXPLAYERSCOMMAND_FILTER_CONNECTEDtarget_namesizeof(target_name), tn_is_ml)) <= 0)
    {
        
ReplyToTargetError(clienttarget_count);
        return 
Plugin_Handled;
    }
    
    for (
int i 0target_counti++)
    {
        
ChangeClientTeam(target_list[i], CS_TEAM_SPECTATOR);
    }
    return 
Plugin_Handled;
}


stock bool IsClientValid(int client)
{
    return ((
client 0) && (client <= MaxClients));

__________________


Max-Play.pl - the best polish servers
CamerDisco 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:13.


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