Quote:
Originally Posted by WoZeR
|
WoZeR,
Thanks for the information. I did review some of those links that where sticked in your forums in the past and was not aware of some of the other examples you had online. I have been trying to get this working myself all night and so far have it setup to attach a SG to the engie who creates it and it will stick to them until they die and then re-attach at death. I believe this is because of the "SetParent" is setup to use the same settings as the 'Parachute' example.
Would you be able to assist me with being able to set this to build where ever the engie has the blue prints pointed or atleast point me in the right direction with some examples as I am kinda lost at this point. This is my very first attempts at plugins or scripts so please do not laugh to hard if its completely ass backwards.
Code:
#include <sourcemod>
#include <sdktools>
#include <events>
#include <clients>
#define PLUGIN_VERSION "1.0.0"
// Plugin definitions
public Plugin:myinfo =
{
name = "Set Sentry Parent",
author = "Your name here",
description = "What the plugin does",
version = PLUGIN_VERSION,
url = "http://www.yourwebsite.com"
}
public OnPluginStart()
{
HookEvent("player_builtobject", Event_player_builtobject)
}
public Action:Event_player_builtobject(Handle:event, const String:name[], bool:dontBroadcast)
{
new sentrygun_index
sentrygun_index = FindEntityByClassname(-1, "obj_sentrygun") //Find the sentry gun entity index starting at 0
new client
client = GetClientOfUserId(GetEventInt(event,"userid")) //Using a hook event get the UserID of the player that triggered
new String:strTargetName[64]
IntToString(client, strTargetName, 64)
DispatchKeyValue(client, "targetname", strTargetName)
SetVariantString(strTargetName)
AcceptEntityInput(sentrygun_index, "SetParent", -1, -1, -0)
return Plugin_Continue
}
public OnMapStart()
{
}
I did try modifying the '-1, -1, -0' to various other strings of 1's and 0's and it appears to change the location of the mount on the players body which is neat since I can now have engie walking around with SG's attached at knee height. (Correct me if I am wrong here please)
-Jeremy