Raised This Month: $ Target: $400
 0% 

green chat/days menu/admin tag help!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-28-2012 , 10:57   Re: Scripting Help
Reply With Quote #4

server_cmd is a function in amxmdx.inc
const szCommand[] is the main parameter (its the command you want to execute inputted as a string)
, any . . . means you're able to put in variables to the previous string.
for example.....
Code:
server_cmd("amx_gravity %d", iGravityToSet)
That's going to take a little bit of experience to do. Its not a simple "Hello World" app. But here's a real simple way of doing it. (not exactly what you want, because i'm lazy and don't want to give you all the answers)
PHP Code:
#include <amxmodx>

#define PLUGIN "Echo"
#define VERSION "1.0"
#define AUTHOR "Liverwiz"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say""handleSay")    // hook say command to handleSay (say is chat in game -default 'y')
}

public 
handleSay(id)
{
    new 
szInput[192]        // 192 is maxlen of text in chat (factoid for you)
    
read_args(szInputcharsmax(szInput) )    // this grabs what the player said
    
remove_quotes(szInput)        // remove quotes so it doesn't get messy
    
    
new szOutput[200], szName[32]    // initialize all variables we're going to use
    
get_user_name(idszNamecharsmax(szName) )
    
        
// This puts the name and input into one string
        // preping to print....
    
formatex(szOutputcharsmax(szOutput), "%s said: %s"szNameszInput)
    
    
client_print(0print_chatszOutput)
    
    return 
PLUGIN_CONTINUE

You should note that the formatex, and consequently szOutput are not required. You can put that directly into the client_print. I only put it there as an example if you were going to go the "SayText" message route, you'll have to use that method.

I wrote a plugin that does soemthing of this nature (plus lots of other crap) its called Private Message. You'll find it in new plugin submissions. It'll give you an example of grabbing text, minipulating it, and printing it using SayText messages
__________________
What an elegant solution to a problem that doesn't need solving....

Last edited by Liverwiz; 08-28-2012 at 11:00.
Liverwiz is offline
 



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:42.


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