Raised This Month: $ Target: $400
 0% 

Solved Compile error: RegAdminCmd (function prototypes...)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 11-21-2016 , 09:44   Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #1

Hi, When I try to compile this string:
PHP Code:
    RegAdminCmd("sm_setzombie"Command_BoostADMFLAG_SLAY"Command to start Boost");
    
RegAdminCmd("sm_debugzombie"Command_DebugBoostADMFLAG_ROOT"Command boost debug"); 
i get this error: "function prototypes do not match" (Using SM 1.8, I've tried to use newdecls but no solution)
Thanks, Papero

Last edited by Papero; 11-21-2016 at 10:52.
Papero is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 11-21-2016 , 09:50   Re: Compile error
Reply With Quote #2

It's ok, I compiled it without any problems. Give us all your code.
__________________


Max-Play.pl - the best polish servers
CamerDisco is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 11-21-2016 , 09:55   Re: Compile error
Reply With Quote #3

PHP Code:
//CompilerOptions
#pragma semicolon 1
#pragma newdecls required

#define DEBUG

#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"
//Includes
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
//Variables
ConVar g_cvFriendlyFire;
ConVar g_cvOldFriendlyFire;
bool hastoggled;


public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_poststart"Event_roundstartpostEventHookMode_Post);
//    HookEvent("round_start", roundstart); #Using PostStart event
    
HookEvent("round_end"Event_RoundEnd);
    
RegAdminCmd("sm_setff"Command_FFSetADMFLAG_SLAY"Command to start ff");
    
RegAdminCmd("sm_debugff"Command_FFDebugADMFLAG_ROOT"Command ff debug");

}

public 
void Event_roundstartpost(Event event, const char[] namebool dontBroadcast)
{
    if (
hastoggled)
    {
        
g_cvFriendlyFire FindConVar("mp_friendlyfire");
        
g_cvOldFriendlyFire g_cvFriendlyFire;
        
g_cvFriendlyFire.IntValue 0;
        
    }
    
    
hastoggled false;
}

public 
Action Command_FFSet(Event event, const char[] namebool dontBroadcast)
{
    
hastoggled true;
}

public 
void Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    
g_cvFriendlyFire.IntValue g_cvOldFriendlyFire;
}

public 
Action Command_FFDebug(int client)
{
    
ReplyToCommand(client"Active!");

Game: CS:GO

Last edited by Papero; 11-21-2016 at 09:57.
Papero is offline
cristian20042
AlliedModders Donor
Join Date: Jun 2016
Location: Romania
Old 11-21-2016 , 09:59   Re: Compile error
Reply With Quote #4

Quote:
Originally Posted by Papero View Post
PHP Code:
//CompilerOptions
#pragma semicolon 1
#pragma newdecls required

#define DEBUG

#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"
//Includes
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
//Variables
ConVar g_cvFriendlyFire;
ConVar g_cvOldFriendlyFire;
bool hastoggled;


public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_poststart"Event_roundstartpostEventHookMode_Post);
//    HookEvent("round_start", roundstart); #Using PostStart event
    
HookEvent("round_end"Event_RoundEnd);
    
RegAdminCmd("sm_setff"Command_FFSetADMFLAG_SLAY"Command to start ff");
    
RegAdminCmd("sm_debugff"Command_FFDebugADMFLAG_ROOT"Command ff debug");

}

public 
void Event_roundstartpost(Event event, const char[] namebool dontBroadcast)
{
    if (
hastoggled)
    {
        
g_cvFriendlyFire FindConVar("mp_friendlyfire");
        
g_cvOldFriendlyFire g_cvFriendlyFire;
        
g_cvFriendlyFire.IntValue 0;
        
    }
    
    
hastoggled false;
}

public 
Action Command_FFSet(Event event, const char[] namebool dontBroadcast)
{
    
hastoggled true;
}

public 
void Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    
g_cvFriendlyFire.IntValue g_cvOldFriendlyFire;
}

public 
Action Command_FFDebug(int client)
{
    
ReplyToCommand(client"Active!");

Game: CS:GO
Why did you do that ?

public Action Command_FFSet(Event event, const char[] name, bool dontBroadcast)

New Code (not tested):
PHP Code:
//CompilerOptions
#pragma semicolon 1
#pragma newdecls required

#define DEBUG

#define PLUGIN_AUTHOR "Hexah"
#define PLUGIN_VERSION "1.00"
//Includes
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
//Variables
ConVar g_cvFriendlyFire;
ConVar g_cvOldFriendlyFire;
bool hastoggled;


public 
Plugin myinfo 
{
    
name "",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url ""
};

public 
void OnPluginStart()
{
    
HookEvent("round_poststart"Event_roundstartpostEventHookMode_Post);
//    HookEvent("round_start", roundstart);
    
HookEvent("round_end"Event_RoundEnd);
    
RegAdminCmd("sm_setff"Command_FFSetADMFLAG_SLAY"Command to start ff");
    
RegAdminCmd("sm_debugff"Command_FFDebugADMFLAG_ROOT"Command ff debug");

}

public 
void Event_roundstartpost(Event event, const char[] namebool dontBroadcast)
{
    if (
hastoggled)
    {
        
g_cvFriendlyFire FindConVar("mp_friendlyfire");
        
g_cvOldFriendlyFire g_cvFriendlyFire;
        
g_cvFriendlyFire.IntValue 0;
        
    }
    
    
hastoggled false;
}

public 
Action Command_FFSet(int client)
{
    
hastoggled true;
}

public 
void Event_RoundEnd(Event event, const char[] namebool dontBroadcast)
{
    
g_cvFriendlyFire.IntValue g_cvOldFriendlyFire;
}

public 
Action Command_FFDebug(int client)
{
    
ReplyToCommand(client"Active!");

cristian20042 is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 11-21-2016 , 10:03   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #5

Quote:
Originally Posted by cristian20042 View Post
public Action Command_FFSet(Event event, const char[] name, bool dontBroadcast)
Yes that was my error but it give to me always the same error: function prototypes do not match.
Papero is offline
CamerDisco
AlliedModders Donor
Join Date: Aug 2015
Location: Poland
Old 11-21-2016 , 10:11   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #6

If you are using cmds, it should see:
PHP Code:
public Action Command_FFSet(int clientint args
instead
PHP Code:
public Action Command_FFSet(Event event, const char[] namebool dontBroadcast
(Event event, const char[] name, bool dontBroadcast) is to events only.
__________________


Max-Play.pl - the best polish servers

Last edited by CamerDisco; 11-21-2016 at 10:13.
CamerDisco is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 11-21-2016 , 10:52   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #7

Thanks it worked!
Papero is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 11-21-2016 , 12:42   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #8

I recommend you to check this out: https://sm.alliedmods.net/new-api/console/RegAdminCmd
And always click on words with a green line, that will tell you what you must do.
__________________
Benoist3012 is offline
beastedout
Member
Join Date: Aug 2018
Old 09-05-2018 , 05:01   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #9

Hey guys, sorry for bumping old post but I have same problem!
Code:
#include <sourcemod>
#include <colorvariables>

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo = 
{
    name = "",
    author = "",
    description = "",
    version = "1.0",
    url = ""
};

public void OnPluginStart()
{
    RegAdminCmd("sm_admincommnds",	CMD_COMMANDS,	ADMFLAG_ROOT,	"To see all admin commands!"); //line 18
}

public Action CMD_COMMANDS()
{
}
Code:
scripting\admincommands.sp(18) : error 100: function prototypes do not match
What am I doing wrong ?
beastedout is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 09-05-2018 , 05:24   Re: Compile error: RegAdminCmd (function prototypes...)
Reply With Quote #10

Instead of bumping old resolved threads make your own.

https://wiki.alliedmods.net/Commands...Admin_Commands

You need two parameters in your callback.
__________________
Neuro Toxin 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 16:24.


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