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

Include Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 00:55   Include Help
Reply With Quote #1

I'm trying to execute the function Event_Gibbed and the compiler is telling me I don't have it included. Can anyone help?
LionElJonson is offline
BAILOPAN
Join Date: Jan 2004
Old 10-18-2007 , 02:08   Re: Include Help
Reply With Quote #2

What? It's kind of hard to tell you what's wrong without seeing the code.
__________________
egg
BAILOPAN is offline
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 02:20   Re: Include Help
Reply With Quote #3

Code:
#include <sourcemod>
#include <events>
#include <entity>
#include <string>
#include <sdktools>


public Plugin:myinfo = 
{
    name = "",
    author = "",
    description = "",
    version = "1.0",
    url = "http://www.sourcemod.net/"
};

public OnPluginStart()
{
    HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre)
}
 
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    decl String:weapon[64]
    GetEventString(event, "weapon", weapon, 64)
    if(GetEventInt(event, "customkill") && StrContains(weapon, "sniperrifle", false) != -1)
    {
        Event_Gibbed(info)
    
    }
    return Plugin_Continue
}
LionElJonson is offline
BAILOPAN
Join Date: Jan 2004
Old 10-18-2007 , 02:31   Re: Include Help
Reply With Quote #4

There's no such function in the SourceMod API. What are you trying to do?
__________________
egg
BAILOPAN is offline
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 02:37   Re: Include Help
Reply With Quote #5

Trying to make a player gib instead of just falling down.
LionElJonson is offline
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 02:37   Re: Include Help
Reply With Quote #6

Oh btw Event_Gibbed is a virtual function for TF2.
LionElJonson is offline
BAILOPAN
Join Date: Jan 2004
Old 10-18-2007 , 03:29   Re: Include Help
Reply With Quote #7

Unfortunately, you can't magically decide that the function will exist when you type it ;) that's a rather esoteric one that's not supported out of the box. You have to write low-level SDKTools code. However, this function takes in a CTakeDamageInfo, which is not a structure that can be expressed in Pawn yet. You'd need to file a feature request to get that data type supported.

Luckily, that function (at least in the SDK) never actually READS the CTakeDamageInfo data. Therefore it's probably safe to hack a random value in - try this example code as a basis - I haven't tested it, so don't blame me if it crashes or something ;] If it does, it probably means the mod needs valid CTakeDamageInfo data. Don't forget the gamedata file.

source code:
Code:
#include <sourcemod> #include <sdktools>   new Handle:hGameConf; new Handle:hEventGibbed;   public OnPluginStart() {     hGameConf = LoadGameConfigFile("gibexample.games");       StartPrepSDKCall(SDKCall_Player);     PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Event_Gibbed");     PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Plain);     hEventGibbed = EndPrepSDKCall(); } GibPlayer(client) {     SDKCall(hEventGibbed, client, 0); }

gamedata file (gibexample.games.txt):
Code:
"Games"
{
	"tf"
	{
		"Offsets"
		{
			"Event_Gibbed"
			{
				"windows"	"251"
				"linux"		"252"
			}
		}
	}
}
__________________
egg
BAILOPAN is offline
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 09:34   Re: Include Help
Reply With Quote #8

You sir are a rock star.
LionElJonson is offline
LionElJonson
Junior Member
Join Date: Oct 2007
Old 10-18-2007 , 22:10   Re: Include Help
Reply With Quote #9

Okay I did some modifications and here is what I have now:

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

new Handle:hGameConf;
new Handle:hEventGibbed;

public Plugin:myinfo =
{
    name = "",
    author = "",
    description = "",
    version = "",
    url = "http://www.sourcemod.net/"
};

public OnPluginStart()
{
    hGameConf = LoadGameConfigFile("gibexample.games");
    StartPrepSDKCall(SDKCall_Player);
    PrepSDKCall_SetFromConf(hGameConf, SDKConf_Virtual, "Event_Gibbed");
    hEventGibbed = EndPrepSDKCall();

    HookEvent("player_death", Event_PlayerDeath, EventHookMode_Pre);
    
}

public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast)
{
    new userclient= GetClientOfUserId(GetEventInt(event, "userid"));
  
    new attackerId = GetEventInt(event, "attacker");
    
    decl String:weapon[64];
    GetEventString(event, "weapon", weapon, sizeof(weapon));
    
    new headshotId = GetEventInt(event, "customkill");
    
    new attacker = GetClientOfUserId(attackerId);
    decl String:attname[64];
    GetClientName(attacker, attname, sizeof(attname));
    
    if(GetEventInt(event, "customkill") == 1)
    {
        SDKCall(hEventGibbed, userclient);
    PrintToConsole(userclient,
        "You should have gibbed by \"%s\" (weapon \"%s\") (headshot \"%d\")",
        attname,
        weapon,
        headshotId);        
        return Plugin_Handled;     
    }
    else
    {
     PrintToConsole(userclient,
        "You were killed by \"%s\" (weapon \"%s\") (headshot \"%d\")",
        attname,
        weapon,
        headshotId);    
    }
    
    return Plugin_Continue;
}
Code:
"Games"
{
    "tf"
    {
        "Offsets"
        {
            "Event_Gibbed"
            {
                "windows"    "251"
                "linux"        "252"
            }
        }
    }
}
You can see that I have some printing statements to help give me feedback on what is going on. When a player gets shot in the head the statement "You should have gibbed by..." is printing, but the actual SDKCall() function that calls virtual function "Event_Gibbed" appears to be doing nothing; no errors or anything. Any ideas?

Last edited by LionElJonson; 10-19-2007 at 14:54.
LionElJonson 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 12:25.


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