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

[CSGO]SDKHooks: Instruction contained invalid parameter


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Nerus
Senior Member
Join Date: Aug 2010
Location: Poland
Old 04-15-2018 , 04:27   [CSGO]SDKHooks: Instruction contained invalid parameter
Reply With Quote #1

I have the same problem on 1.9 and 1.8 SM.

Problem:
On shoot temmate, plugn blaming:

Code:
L 04/15/2018 - 00:15:48: [SM] Exception reported: Instruction contained invalid parameter
L 04/15/2018 - 00:15:48: [SM] Blaming: teamkill.smx
L 04/15/2018 - 00:15:48: [SM] Call stack trace:
L 04/15/2018 - 00:15:48: [SM]   [1] Line 64, teamkill.sp::OnTakeDamage
Code:
PHP Code:
#include <maincore>

#pragma semicolon 1
#pragma newdecls required

#define PLUGIN_NAME            "Team kill"
#define PLUGIN_VERSION        "v1.0"
#define PLUGIN_DESCRIPTION    "Controling team killing"
#define DEBUG                1

public Plugin myinfo 
{
    
name PLUGIN_NAME,
    
author "Nerus",
    
description PLUGIN_DESCRIPTION,
    
version PLUGIN_VERSION,
    
url "https://forums.alliedmods.net/"
};

enum PluginErrors
{
    
SDKHookError 1
}

public 
void OnClientPostAdminCheck(int client)
{
    if(!
IsValidClient(client))
    {
        
#if DEBUG
        
PrintToServer("Client: [%d] is invalid"client);
        
#endif

        
return;
    }

    if(!
SDKHookEx(clientSDKHook_OnTakeDamageAliveOnTakeDamage))
        
ThrowError("Can't hook client: [%d]%N 'On Take Damage'."clientclient);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetypeint &weaponfloat damageForce[3], float damagePosition[3], int damagecustom)
{
    if(
IsValidPlayer(victimfalse) && IsValidPlayer(attackerfalse))
    {
        if(
IsSamePlayer(victimattacker))
            return 
Plugin_Continue;
        else
        {
            
//char WeaponCallBack[32];
            //GetEdictClassname(inflictor, WeaponCallBack, sizeof(WeaponCallBack));

            //if(StrEqual(WeaponCallBack, "inferno", false) || StrEqual(WeaponCallBack, "hegrenade_projectile", false))
            //    return Plugin_Continue;
        
}

        if(
IsTeammate(victimattacker))
            return 
Plugin_Handled;
    }

    
// Plugin_Continue    Continue with the original action
    // Plugin_Changed    Inputs or outputs have been overridden with new values
    // Plugin_Handled    Handle the action at the end (don't call it)
    // Plugin_Stop        Immediately stop the hook chain and handle the original

    
return Plugin_Continue// <-- this is 64 line nr.

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <cstrike>
#include <multicolors>

#pragma semicolon             1

//////////////////
// PLAYER

stock int GetClientFromEvent(Handle event)
{
    return 
GetClientOfUserId(GetEventInt(event"userid"));
}

stock int GetAttackerFromEvent(Handle event)
{
    return 
GetClientOfUserId(GetEventInt(event"attacker"));
}

stock bool IsClient(int client)
{
    return (
client && client MaxClients+1);
}

stock bool IsValidClient(int client)
{
    return (
IsClient(client) && IsClientConnected(client) && IsClientInGame(client));
}

stock bool IsValidPlayer(int clientbool only_human)
{
    if(
only_human)
        return (
IsValidClient(client) && !IsClientSourceTV(client) && !IsFakeClient(client));
    else
        return (
IsValidClient(client) && !IsClientSourceTV(client));
}

stock bool IsDeadPlayer(int clientbool only_human false)
{
    return (
IsValidPlayer(clientonly_human) && !IsPlayerAlive(client));
}

stock bool IsAlivePlayer(int clientbool only_human)
{
    return (
IsValidPlayer(clientonly_human) && IsPlayerAlive(client));
}

stock bool IsBot(int client)
{
    return (
IsValidPlayer(clientfalse) && IsFakeClient(client));
}

stock bool IsSourceTV(int client)
{
    return (
IsValidClient(client) && IsClientSourceTV(client));
}

stock bool IsSamePlayer(int clientint other)
{
    return (
client == other);
}

stock bool IsPlayerAlone(int client)
{
    return ( 
IsAlivePlayer(clientfalse) && (GetPlayersCountFromTeam(GetClientTeam(client), ONLY_ALIVES, !ONLY_HUMMANS) < 2) );
}

stock bool IsVip(int client)
{
    return (
IsValidPlayer(clienttrue) && GetUserAdmin(client) != INVALID_ADMIN_ID);
}

stock bool IsAdmin(int client)
{
    return (
IsValidPlayer(clienttrue) && GetAdminFlag(GetUserAdmin(client), Admin_Generic));
}

//////////////////
// Team

stock bool IsTeammate(int clientint second)
{
    return (
GetClientTeam(client) == GetClientTeam(second));


Last edited by Nerus; 04-15-2018 at 11:38.
Nerus is offline
 



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 06:49.


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