Raised This Month: $ Target: $400
 0% 

Q:How to run commands from one plugin out of another plugin?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
RedBaron
Junior Member
Join Date: Apr 2004
Old 04-17-2004 , 19:47   Q:How to run commands from one plugin out of another plugin?
Reply With Quote #1

I'm runing the BlattMonster- and the Anticamping-Plugin and instead of slaping the user/player, like in "case 1", I'd like to spawn a monster on the camper, like bbmonster_spawn <monster> <player>, from the BlattMonster-Plugin!!!

How to do??? Any suggestions???

Code:
// a part out of anticamping.sma        ....         } else if (campmeter[id]>100) {             switch(get_cvar_num("anticamping")) {                 case 1: {                     user_slap(id,get_cvar_num("anticamping_healthpunish"))              }                 case 2: {                     set_user_health(id, get_user_health(id) - get_cvar_num("anticamping_healthpunish"))                 }                 case 3: {                     emit_sound(id,CHAN_VOICE,"player/heartbeat1.wav", 1.0, ATTN_NORM, 0, PITCH_NORM)        ....
RedBaron is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-17-2004 , 20:56  
Reply With Quote #2

Execute the command on the server(servercmd(cmd[]), I think)
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
QwertyAccess
Veteran Member
Join Date: Feb 2004
Location: Enjiru Layer
Old 04-17-2004 , 21:36  
Reply With Quote #3

well ice you need to specify what to execute too.
__________________
QwertyAccess is offline
RedBaron
Junior Member
Join Date: Apr 2004
Old 04-18-2004 , 01:15  
Reply With Quote #4

okay, the command is
Code:
server_cmd(" command ")
and works fine, when I use it like this

server_cmd("bbmonster_spawn agrunt RedBaron")

green = plugincommand
blue = monstername
red = playername

but now I'd like to know, how I get the playername, who is realy camping???
I know there is this cmd
Code:
new playername[32] get_user_name(id, playername, 31)
but its not working for me or I'm doing somthing wrong, I dont know???
I'm to tiered immo to find out! Its 06:15am here in Germany and I'll try later again to solve my problem, but I'd be glad, if someone could help me out in the meanwhile! Goodnight all and thx for ur help!!!
RedBaron is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-18-2004 , 02:09  
Reply With Quote #5

Code:
new playername[33]; new cmd[129] get_user_name(id,playername,32); format(cmd,128, "bbmonster_spawn agrunt %s",playername); servercmd(cmd);
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
RedBaron
Junior Member
Join Date: Apr 2004
Old 04-18-2004 , 08:55  
Reply With Quote #6

thx Ice,

it now works pretty well for me, but it must be
Code:
server_cmd(cmd)
and not
Code:
servercmd(cmd)
but what the heck, it works!!!

mucho thx
RedBaron is offline
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-18-2004 , 09:33  
Reply With Quote #7

There is no need to format the cammand as the newer versions of amx and amxmodx have built in format:

native server_cmd(const command[],{Float,_}:...);

Which makes the code redundant and bloated.

As for:
Quote:
new playername[32]
get_user_name(id, playername, 31)
The reason it is not working from what I can see is that whomever has called the function is the person identified by id. So if you the admin are calling the amx_killthecampercommand, then the monster will spawn on you! Hehehe...so to be heplful, of which I cannot at the moment, I need to see the full code of the area you are trying to modify...then I can be helpful!

Cheers! and Luck!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
RedBaron
Junior Member
Join Date: Apr 2004
Old 04-18-2004 , 10:59  
Reply With Quote #8

huh, Zor???

This works just fine for me!!!
Code:
new playername[33]; new cmd[129] get_user_name(id,playername,32); format(cmd,128, "bbmonster_spawn agrunt %s",playername); server_cmd(cmd);
I dont know what u mean???
RedBaron is offline
IceMouse[WrG]
Senior Member
Join Date: Mar 2004
Old 04-18-2004 , 12:40  
Reply With Quote #9

Zor, call me old fashoned, then, but way back when thats how we did it!
IceMouse[WrG] is offline
Send a message via AIM to IceMouse[WrG] Send a message via MSN to IceMouse[WrG] Send a message via Yahoo to IceMouse[WrG]
Zor
Veteran Member
Join Date: Mar 2004
Location: Toronto, ON
Old 04-18-2004 , 16:46  
Reply With Quote #10

No matter, thats just bloat but if it works good to go...didn't know you had solved it. And IceMouse[WrG], soakay we all begin somewhere! Anyway its because ppl wanted this ability without having to format a string that the code went this way, but as I say, its just easier now.

Cheers!
__________________
Zor is offline
Send a message via AIM to Zor Send a message via MSN to Zor Send a message via Yahoo to Zor
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 05:27.


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