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

Solved Argument type mismatch (argument 5)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Whai
Senior Member
Join Date: Jul 2018
Old 08-26-2018 , 18:38   Argument type mismatch (argument 5)
Reply With Quote #1

Hello, I have a problem, I got these errors

Code:
error 035: argument type mismatch (argument 5) // Line 90
error 035: argument type mismatch (argument 6) // Line 91
My Code :
PHP Code:
#include <sourcemod>
#include <sdkhooks>

#pragma semicolon 1
#define PLUGIN_VERSION "1.0"

new Handle:c_defaultdamage INVALID_HANDLE;
new 
Float:xDamage[MAXPLAYERS+1];

public 
Plugin:myinfo =
{
    
name "Damage Multiplier",
    
author "Whai",
    
description "Multiply the damage of a player",
    
version PLUGIN_VERSION,
    
url ""
}

public 
OnPluginStart()
{
    
c_defaultdamage CreateConVar("sm_defaultdmg""1""Default damage multiplier"0true0.0false);
    
RegAdminCmd("sm_damage"Command_damageADMFLAG_SLAY"Multiply the damage of a player");
}

public 
OnClientPutInServer(client)
{
    
xDamage[client] = GetConVarFloat(c_defaultdamage);
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
OnClientDisconnect(client)
{
    
xDamage[client] = GetConVarFloat(c_defaultdamage);
}

public 
Action OnTakeDamage(victim, &attacker, &inflictor, &Float:damage, &damagetype)
{
    new 
Float:multiply 1.0;
    new 
Float:defaultmulti GetConVarFloat(c_defaultdamage);
    if (
attacker && attacker <= MAXPLAYERS)
    {
        if(
xDamage[attacker] != defaultmulti)
        {
            if(
xDamage[attacker] == 0
            {
                
damage == 0.0;
            }
            else
            {
                
damage *= multiply xDamage[attacker] - 1.0;
            }
        }
    }
    if(
victim == attacker)
    {
        
damage *= 1.0;
    }
    return 
Plugin_Continue;
}

public 
Action Command_damage(clientargs)
{
    if(
args == && args == 2)
    {
        
ReplyToCommand(client"[SM] Usage: sm_damage <player> <multiplier>");
        return 
Plugin_Handled;
    }
    new 
String:mdamage[32];
    if(
args == 1)
    {
        
GetCmdArg(1mdamagesizeof(mdamage));
        
xDamage[client] = StringToFloat(mdamage);
        
PrintToChat(client"Your Damage is now multipled by %i"mdamage);
    }
    new 
String:arg1[MAX_NAME_LENGTH];
    
GetCmdArg(1arg1sizeof(arg1));
    new 
String:multiplier[32];
    if(
args == 2)
    {
        
GetCmdArg(2multipliersizeof(multiplier));
        
        
decl String:target_name[MAX_TARGET_LENGTH];
        
decl target_list[MAXPLAYERS], target_countbool:tn_is_ml;
    
        if ((
target_count ProcessTargetString(
                
arg1,
                
client,
                
target_list,
                
MAXPLAYERS,
                
target_name,              //Line 90
                
sizeof(target_name),      //Line 91
                
tn_is_ml)) <= 0)
        {
            
ReplyToTargetError(clienttarget_count);
            return 
Plugin_Handled;
        }
 
        for (
int i 0target_counti++)
        {
            new 
target target_list[i];
            
xDamage[target] = StringToFloat(multiplier);
        }
 
        if (
tn_is_ml)
        {
            
ShowActivity2(client"[SM] ""Multiplied damage %t by %d!"target_namemultiplier);
        }
        else
        {
            
ShowActivity2(client"[SM] ""Multiplied damage %s by %d!"target_namemultiplier);
        }
        return 
Plugin_Handled;
    }
    return 
Plugin_Handled;

Errors :
PHP Code:
target_name,
sizeof(target_name), 
Maybe I did a lot of errors (I think yes)
__________________

Last edited by Whai; 10-28-2018 at 16:04.
Whai is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 08-26-2018 , 19:50   Re: Argument type mismatch (argument 5)
Reply With Quote #2

You missed a parameter in ProcessTargetString, so what you pass to it doesn't match what it wants. That's why the error says there's an argument mismatch. The 5th parameter is filter flags, not the target name buffer.
Fyren is offline
Whai
Senior Member
Join Date: Jul 2018
Old 08-27-2018 , 12:31   Re: Argument type mismatch (argument 5)
Reply With Quote #3

Thank you for this reply and for the solution
__________________
Whai 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 19:33.


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