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

error035: Argument type missmatch (argument 3)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cloudian
New Member
Join Date: Dec 2018
Old 12-17-2018 , 07:55   error035: Argument type missmatch (argument 3)
Reply With Quote #1

I'm new to programming in sourcepawn but I have a problem:
I get the error "Argument type missmatch" on line 33.

Code:
#include <sourcemod>
#include <sdktools>

public Plugin myinfo = {
    name="ReportPlugin",
    author="Olle Thunberg",
	description = "Adds the reports to the database",
	version = "1.0",
	url = "http://www.sourcemod.net/"
}

public void OnPluginStart(){
	RegConsoleCmd("sm_report", sm_report);

}
public Action:sm_report(int client, int args){
	
	new String:reported[32];
	GetCmdArg(1, reported, sizeof(reported));

	if(client){
			ReplyToCommand(client, "Reported the user: %s", reported);
			
			    new String:error[255];
				new Handle:db = SQL_DefConnect(error, sizeof(error));
				if(db == null){
					PrintToServer("Failed to connect to database: %s", error);
					return Plugin_Handled;
				}else {
					// FIXA MER HÄR IMORGON
					// FIXA MER HÄR IMORGON
					// FIXA MER HÄR IMORGON
					if(!SQL_FastQuery(db, "UPDATE users SET reports = reports + 1 WHERE steamid = '%s'", reported)){
						char error[255];
						SQL_GetError(db, error, sizeof(error));
						PrintToServer("Failed to query (error: %s)", error);
					}

				}
	}
	return Plugin_Handled;
	
}
I would love if someone could tell me what's wrong!
cloudian is offline
backwards
AlliedModders Donor
Join Date: Feb 2014
Location: USA
Old 12-17-2018 , 08:30   Re: error035: Argument type missmatch (argument 3)
Reply With Quote #2

you can use the sourcemod api to look up the arguments to see what could be wrong.
SQL_FastQuery Function

the 3rd argument of that function is
Quote:
int len
Optional parameter to specify the query length, in bytes. This can be used to send binary queries that have a premature terminator.
So you can just remove the third argument. You have to format the string before you use the function as it's not accepting formatting or
PHP Code:
(, ...) 
argument types.

So you can use something like Format to write the value of the reported variable into the %s buffer space. Then pass that fully formated string into argument 2 of the SQL_FastQuery function.
__________________
I highly recommend joining the SourceMod Discord Server for real time support.
backwards 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 09:17.


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