Raised This Month: $ Target: $400
 0% 

Calling a plugin from plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
avitardotnet
Junior Member
Join Date: Feb 2009
Location: CA, USA
Old 02-18-2009 , 22:27   Calling a plugin from plugin
Reply With Quote #1

Hey,

I was looking at other plugins that come with sourcemod and saw includes to pull scripts remotely via #include however I want to know if you can call a compiled smx the same way and use it.. in some regaurd similair to:

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

#include <sm_slap.smx>
#include <sm_freeze.smx>
#include <sm_gravity.smx>
#include <sm_explode.smx>
#include <sm_explode.smx>

//use custom model
new bool:modelchange = false;

public Plugin:myinfo = {
	name = "Fatality",
	author = "David Smith",
	description = "<- Allows for players to become a Predator ->",
	version = "1.1.0.0",
	url = "http://avitar.net/"
};
 
public OnPluginStart() {
	RegAdminCmd("sm_fatality", Command_Leap, ADMFLAG_SLAY, "sm_fatality <#userid|name>");
}

public Action:Command_Predator(client,args) {
	
	if (args == 1){
	
		new String: arg1[32];
		GetCmdArg(1, arg1, sizeof(arg1));
		new victim = FindTarget(client, arg1);

		if(target != -1){ 

		// execute evil slayage
		sm_gravity victim;
		sm_slap victim;
		sm_freeze victim;
		sm_explode victim;
		sm_slay victim;
		
		}
	}
}
also is there
avitardotnet is offline
Lebson506th
Veteran Member
Join Date: Jul 2008
Old 02-18-2009 , 23:58   Re: Calling a plugin from plugin
Reply With Quote #2

You can just do ServerCommand("sm_whatever %s", argshere)


No need to include anything.
__________________
My Plugins
Spray Tracer by Nican, maintained by me
Simple TK Manager
DoD:S Admin Weapons

Links
Resistance and Liberation (A HL2 Multiplayer Modification)
Lebson506th is offline
naris
AlliedModders Donor
Join Date: Dec 2006
Old 02-21-2009 , 14:26   Re: Calling a plugin from plugin
Reply With Quote #3

If you write both plugins, you can also create natives and use those (which is more flexible):
http://wiki.alliedmods.net/Creating_Natives_(SourceMod_Scripting)

and/or use forwards:
http://wiki.alliedmods.net/Function_Calling_API_(SourceMod_Scripting)

You can also modified plugins that you want to use to add natives to them so that you can call them from other plugins. I have done this many times.

Last edited by naris; 02-21-2009 at 14:29.
naris is offline
BAILOPAN
Join Date: Jan 2004
Old 02-22-2009 , 12:18   Re: Calling a plugin from plugin
Reply With Quote #4

Using server commands is not recommended for interop. It's non-deterministic - you don't know when it will actually execute.
__________________
egg
BAILOPAN is offline
Avitar
Junior Member
Join Date: Feb 2005
Old 02-24-2009 , 23:57   Re: Calling a plugin from plugin
Reply With Quote #5

Quote:
Originally Posted by BAILOPAN View Post
Using server commands is not recommended for interop. It's non-deterministic - you don't know when it will actually execute.
Good to know; this is more important than actually knowing the command since it is directly opposed to general programming practices -- build modular -- which would have actually caused me more problems in the long run.
Avitar 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 13:27.


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