Raised This Month: $ Target: $400
 0% 

green chat/days menu/admin tag help!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
illusionalp
Member
Join Date: Aug 2012
Old 08-28-2012 , 01:23   green chat/days menu/admin tag help!
Reply With Quote #1

hey,
1- i would like to know how can i execute admin commands using a plugin
eg :
lets say that i want to make new command called amx_Shark this command will excute two other commands amx_gravity 100 amx_noclip @ct any thoughts how can i do such thing ? any help will be appreciated
2- i would like to know how can i add a simple tag before the user with flag that i choose lets say flag b if the user had it i want to add [admin] tag before his name any thoughts how can i do that?
3- making a menu just like the guns menu in jailbreak but i want to change the functions like if you choose 1 the gravity will be changed and stuff like that
that is it i guess
regards,

Last edited by illusionalp; 09-02-2012 at 08:52.
illusionalp is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-28-2012 , 01:42   Re: Scripting Help
Reply With Quote #2

1. server_cmd(const szCommand[], any . . .)
2. You'll have to catch each say, grab what they said, then add it to a string of what you want it to say and print it through a "SayText" message or client_print(0, print_chat, szMessage)
3. http://forums.alliedmods.net/showthread.php?t=46364 good tut on menus.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
illusionalp
Member
Join Date: Aug 2012
Old 08-28-2012 , 01:59   Re: Scripting Help
Reply With Quote #3

Quote:
Originally Posted by Liverwiz View Post
1. server_cmd(const szCommand[], any . . .)
2. You'll have to catch each say, grab what they said, then add it to a string of what you want it to say and print it through a "SayText" message or client_print(0, print_chat, szMessage)
3. http://forums.alliedmods.net/showthread.php?t=46364 good tut on menus.
thanks for your reply mate
i can't understand what to do with the first,second answers i'm new to amxmodx scripting
if it is possible can you explain more ? , the third answer worked perfectly
illusionalp is offline
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
illusionalp
Member
Join Date: Aug 2012
Old 08-28-2012 , 16:37   Re: Scripting Help
Reply With Quote #5

Quote:
Originally Posted by Liverwiz View Post
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
thanks for the reply again,

can you make a simple menu for me ? if yes then
1- change gravity to 30 and slap the username who executed it
2- change gravity to 70 and noclip @ct players
it will be appreciated , i need this menu to learn from it
how you did it , etc..
i will change the functions later
and about the chat plugin can you tell me how can i connect it to a flag like if i had flag x then i can have the [admin] tag before my name

Last edited by illusionalp; 08-28-2012 at 16:38.
illusionalp is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-28-2012 , 19:05   Re: Scripting Help
Reply With Quote #6

Quote:
Originally Posted by illusionalp View Post
2- i would like to know how can i add a simple tag before the user with flag that i choose lets say flag b if the user had it i want to add [admin] tag before his name any thoughts how can i do that?
There are plugins that do this already.
__________________
fysiks is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-28-2012 , 23:12   Re: Scripting Help
Reply With Quote #7

go to the request section. I gave you one plugin already....and i'm lazy tonight.

Or just go reading codes that are already written. Pleanty of examples out there. Also look around the tuts and code snippets section. Lots of good stuff there too.
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
illusionalp
Member
Join Date: Aug 2012
Old 08-28-2012 , 23:31   Re: Scripting Help
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
There are plugins that do this already.
Quote:
Originally Posted by Liverwiz View Post
go to the request section. I gave you one plugin already....and i'm lazy tonight.

Or just go reading codes that are already written. Pleanty of examples out there. Also look around the tuts and code snippets section. Lots of good stuff there too.

can you provide links ?
illusionalp is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 08-28-2012 , 23:38   Re: Scripting Help
Reply With Quote #9

http://forums.alliedmods.net/forumdi...to_forumsearch
http://forums.alliedmods.net/forumdisplay.php?f=83
http://forums.alliedmods.net/forumdi...to_forumsearch
http://forums.alliedmods.net/forumdi...to_forumsearch

Hope that's enough....
__________________
What an elegant solution to a problem that doesn't need solving....
Liverwiz is offline
illusionalp
Member
Join Date: Aug 2012
Old 08-29-2012 , 00:21   Re: Scripting Help
Reply With Quote #10

mate i was looking forward for a links to the threads
illusionalp 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 05:42.


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