Hello,
I am trying to do a plugin for CS:GO that with a command next round is only with deagle, but i am getting this error:
PHP Code:
error 147: new-style declarations are required
PHP Code:
#include <sdktools>
#include <mainlib>
#include <multicolors>
#pragma semicolon 1
#pragma newdecls required
#define PLUGIN_TAG "{blue}[ deagleround ]{default}"
#define NAME "Deagle Round"
#define AUTHOR "dias di Ghetto"
#define DESC "Deagle Rounds by a command for VIPs"
#define VERSION "0.1"
ConVar g_bAllowedFlags, g_iTimesPerMap;
Handle:ClientTimer[MAXPLAYERS+1] = {INVALID_HANDLE, ...};
bool isdeagleround = false;
bool deagleroundScheduled = false;
int deaglerounds = 0;
public Plugin myinfo =
{
name = NAME,
author = AUTHOR,
description = DESC,
version = VERSION,
url = "https://diasdighetto.pt"
};
public void OnPluginStart() {
LoadTranslations("deagleround.phrases");
RegConsoleCmd("sm_deagleround", Command_deagleround);
g_bAllowedFlags = CreateConVar("deagleround_allowedflags", "b", "Allowed flags to start a Deagle Round or a vote for it", _, true, 0.0, true, 1.0);
g_iTimesPerMap = CreateConVar("deagleround_maxtimespermmap", "0", "Max amount of times a Deagle round can occur. 0 for unlimited", _, true, 0.0, false);
AutoExecConfig(true, "deagleround");
HookEvent("round_start", OnRoundStart);
HookEvent("item_pickup", OnWeaponPickup);
SetDefaultValues();
}
public Action OnWeaponPickup(Event event, const char[] name, bool dontBroadcast)
{
if (isdeagleround) {
int client = GetClientOfUserId(GetEventInt(event, "userid"));
StripAllWeapons(client);
}
}
public Action Command_deagleround(int client, int args) {
if (!IsValidClient(client)) {
return Plugin_Handled;
}
char allowedFlags[16];
GetConVarString(g_bAllowedFlags, allowedFlags, sizeof(allowedFlags));
if (!HasClientFlag(client, allowedFlags)) {
return Plugin_Handled;
}
int maxdeaglerounds = GetConVarInt(g_iTimesPerMap);
if (deaglerounds == maxdeaglerounds && maxdeaglerounds != 0) {
return Plugin_Handled;
}
Scheduledeagleround();
return Plugin_Handled;
}
void Scheduledeagleround() {
deagleroundScheduled = true;
CPrintToChatAll("%s %t", PLUGIN_TAG, "deagleround Scheduled");
}
public void OnMapStart() {
SetDefaultValues();
}
public void SetDefaultValues() {
deaglerounds = 0;
isdeagleround = false;
deagleroundScheduled = false;
}
public Action OnRoundStart(Event event, const char[] name, bool dontBroadcast) {
if (isdeagleround) {
isdeagleround = false;
}
if (deagleroundScheduled) {
CreateTimer(0.5, Timer_RemoveOtherWeapons, _);
CreateTimer(0.5, Timer_GiveDeagle, _);
deagleroundScheduled = false;
isdeagleround = true;
deaglerounds++;
CPrintToChatAll("%s %t", PLUGIN_TAG, "deagleround Started");
}
}
public Action Timer_RemoveOtherWeapons(Handle timer, any data) {
StripAllPlayers();
}
public Action Timer_GiveDeagle(Handle timer, any client)
{
ClientTimer[client] = INVALID_HANDLE;
ServerCommand("sm_give @all weapon_deagle", client);
}
public void StripAllPlayers() {
for (int i = 1; i <= MaxClients; i++) {
if (IsValidClient(i)) {
StripAllWeapons(i);
}
}
}
public void StripAllWeapons(int client) {
int wp;
for (int i = 0; i < 5; i++) {
wp = GetPlayerWeaponSlot(client, i);
if (i != 2) {
if(IsValidEntity(wp)) {
RemovePlayerItem(client, wp);
}
}
}
}
If someone can help me i really apreciate it ;)