Raised This Month: $ Target: $400
 0% 

Can I call another plugins commands?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KRiMoRaL
New Member
Join Date: Feb 2005
Old 02-24-2005 , 01:49   Can I call another plugins commands?
Reply With Quote #1

I'm wondering if there is a way to call another plugins command from within a plugin i'm writing(trying to)

I currently have the plugins on the server that allow me to use amx_godmode, and amx_noclip..

What I'm trying to do is create a plugin that will allow me to do "amx_zeus <player>" and it will execute "amx_godmode <player> 1" on them. I don't want to call to the includes that use the functions like set_user_godmode(id,1) or whatever.. I specifically want to call to the commands offered by plugins already on the server.

Also, I know that there are probably other Zeus Plugins out there, but this is mostly for me to learn how to do and stuff.. that's why I'm doing it myself.

Here's kind of what I have: Which is just the basic outside

Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="Zeus" new AUTHOR[]="KRiMoRaL" new VERSION[]="1.0" public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("amx_zeus", "cmd_zeus", ADMIN_LEVEL_A, " ")         register_concmd("amx_unzeus", "cmd_unzeus", ADMIN_LEVEL_A, " ") } cmd_zeus(id, level, cid) {     if (!cmd_access(id, level, cid, 3))             return PLUGIN_HANDLED               //I don't know how to call "amx_godmode <player> 1"     //I don't know how to call "amx_noclip <player> 1" } cmd_unzeus(id, level, cid) {     if (!cmd_access(id, level, cid, 3))         return PLUGIN_HANDLED     //Same as above, but to set to 0. }
KRiMoRaL is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2005 , 02:17  
Reply With Quote #2

In your case, you can use the server_cmd function, which runs a server command.

Code:
new username[32]; get_user_name(id,username,31); server_cmd("amx_godmode ^"%s^" 1",username); server_cmd("amx_noclip ^"%s^" 1",username);
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 14:33  
Reply With Quote #3

Try this.. I just copyed and pasted really fast from some of my other plugins. Not sure if it works... Remove the client_print if you want...
Code:
#include <amxmodx> #include <amxmisc> new PLUGIN[]="Zeus" new AUTHOR[]="KRiMoRaL" new VERSION[]="1.0" public plugin_init() {         register_plugin(PLUGIN, VERSION, AUTHOR)         register_concmd("amx_zeus", "cmd_zeus", ADMIN_LEVEL_A, "<name> Gives a player zeus mode")         register_concmd("amx_unzeus", "cmd_unzeus", ADMIN_LEVEL_A, "<name> Removes a players zeus mode") } public cmd_zeus(id, level, cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);    server_cmd(player, "amx_noclip %s 1")    server_cmd(player, "amx_godmode %s 1")    client_print(player, print_chat, "The Admin Gave You Zeus Mode")         return PLUGIN_HANDLED } public cmd_unzeus(id, level, cid) {     if (!cmd_access(id,level,cid,2))          return PLUGIN_HANDLED     new arg[32]     read_argv(1,arg,31)     new player = cmd_target(id,arg,2)     if(!player)          return PLUGIN_HANDLED     new name[64];     get_user_name(player,name,63);     server_cmd(player, "amx_noclip %s 0")     server_cmd(player, "amx_godmode %s 0")     client_print(player, print_chat, "The Admin Removed Your Zeus Mode")          return PLUGIN_HANDLED }
XunTric is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 02-24-2005 , 15:04  
Reply With Quote #4

XunTric, you can't just put %s and expect it to know what string you want it to replace it with, you have to specify that in the additional parameters.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 15:09  
Reply With Quote #5

Umm ok.. Btw avalanche, look at my other thread "Need help with a little NS script" hehe..
XunTric is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 02-24-2005 , 15:10  
Reply With Quote #6

Quote:
Originally Posted by XxAvalanchexX
XunTric, you can't just put %s and expect it to know what string you want it to replace it with, you have to specify that in the additional parameters.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
XunTric
BANNED
Join Date: Jan 2005
Location: Norway/Norge
Old 02-24-2005 , 15:11  
Reply With Quote #7

lol. " "? What was so funny about that? Im not that good at this lol.
XunTric is offline
Reply


Thread Tools
Display Modes

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 14:17.


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