Raised This Month: $12 Target: $400
 3% 

Chat print help.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Cretu
Member
Join Date: Mar 2009
Old 06-07-2009 , 04:39   Chat print help.
Reply With Quote #1

Hello.

This a simple cod that allows you to use amx_freezetime in stead of amx_cvar mp_freezetime.

The THING is that it doen`t print the command in the server`s general chat.

I want it to say on the chat "Command : <admin who uses the command> Changed cvar <freezetime,limitteams or any cvar i wait to put in the plugin> to 1"

COULD someone please add the line for this with red color ( so i know what is added) and someone please explain every single letter`s function ?

Example : new name[32],com[32] // we will use name as a variable for the admins name and com variable for the commad


QUESTION 2 : How i add a wait period in a plugin ? Because I done this :

client_cmd (print_chat;wait;wait;snapshot;wait;wait;)
server_cmd (around 40 waits here)
server_cmd (ban client) .

Is there a special line for those waits ? lie in stead of using 40 waits like that just type : server_wait_20_seconds )

I hope someone help me with this . I must say i`m a total n00b at coding , i just copy a part of a cod , ad another part from another plugin and from 2 part i make 1 plugin and register the plugin under everybody`s names ) . So it won`t be stealing.

Thank you for you`r time .



Code:
#include <amxmodx>
#include <amxmisc>

new mp_freezetime;

public plugin_init()
{
    register_plugin("amx_freezetime", "0.1", "Exolent");
    
    register_concmd("amx_freezetime", "CmdFreezetime", ADMIN_KICK, "<freezetime seconds>");
    
    mp_freezetime = get_cvar_pointer("mp_freezetime");
}

public CmdFreezetime(plr, level, cid)
{
    if( !cmd_access(plr, level, cid, 2) )
    {
        return PLUGIN_HANDLED;
    }
    
    new arg[10];
    read_argv(1, arg, sizeof(arg) - 1);
    
    new num = str_to_num(arg);
    
    set_pcvar_num(mp_freezetime, num);
    
    console_print(plr, "[AMXX] You set mp_freezetime to %i", num);
    
    return PLUGIN_HANDLED;
}

Last edited by Cretu; 06-07-2009 at 04:42.
Cretu is offline
187Ghost187
Junior Member
Join Date: May 2009
Old 06-07-2009 , 07:16   Re: Chat print help.
Reply With Quote #2

Please use the [php] tag's when posting code and the command you're looking for is client_print

PHP Code:
client_print(idprint_chat"Your Message"ThingstoShowInMessage
Where id is, that's where you want to put the user(s) you want to see the message

Your Message must always be in "" but can also contain %s %i %d depending on what type of info being shown (%s = strings, etc.)

where I have "ThingstoShowInMessage" is where you'd put the things you're wanting to show through the %'s
__________________
187Ghost187 is offline
Cretu
Member
Join Date: Mar 2009
Old 06-07-2009 , 07:28   Re: Chat print help.
Reply With Quote #3

First of all , thank you for you`r reply.

ThingstoShowInMessage should be "adminname, clientname"

But how i make adminname = the name of the admin that executed the command
And how i make clientname = the client on wich the command was used.

PHP Code:
client_print(idprint_chat"Command : $s mp_freezetime 0"adminname
This is how the command should be? Wright ?
But it won`t work like this because i dont have "new adminname[32] and other stuff".
Can you please write the whole code that is being used by the client_print function above ? And explain to me the whole thing ? I wan`t to know this so in the future i won`t boder anyone else .


Second question :

If in stead of freeze time is KICK command.

I want this :
PHP Code:
client_print(idprint_chat"Command : %s used command Llama on %s"adminnameclientname
This is how it should be , write ?

In question 1 , the one above you will explain hot i get adminname defined , now explain how i get adminname AND clientname defined (defined i mean to make the function work fine)

THANK YOU

Last edited by Cretu; 06-07-2009 at 07:31.
Cretu is offline
Cretu
Member
Join Date: Mar 2009
Old 06-08-2009 , 04:01   Re: Chat print help.
Reply With Quote #4

anyone reply ? please....
Cretu is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 06-08-2009 , 10:45   Re: Chat print help.
Reply With Quote #5

show full code
Emilioneri is offline
Send a message via Skype™ to Emilioneri
Cretu
Member
Join Date: Mar 2009
Old 06-08-2009 , 11:11   Re: Chat print help.
Reply With Quote #6

Quote:
Originally Posted by Emilioneri View Post
show full code
The full code is in my first post .

If you want you can add in the code with red color the code for what i want and maybe explain everything you add . Exept for the client_print line , i know how it works. I don`t know hot you add the strings.

Thank you.
Cretu is offline
Emilioneri
Senior Member
Join Date: Feb 2009
Location: Georgia, Tbilisi
Old 06-08-2009 , 15:15   Re: Chat print help.
Reply With Quote #7

you mean this?
PHP Code:
#include <amxmodx>
#include <amxmisc>

new mp_freezetime;

public 
plugin_init()
{
    
register_plugin("amx_freezetime""0.1""Exolent");
    
    
register_concmd("amx_freezetime""CmdFreezetime"ADMIN_KICK"<freezetime seconds>");
    
    
mp_freezetime get_cvar_pointer("mp_freezetime");
}

public 
CmdFreezetime(plrlevelcid)
{
    if( !
cmd_access(plrlevelcid2) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    new 
arg[10];
    
read_argv(1argsizeof(arg) - 1);
    
    new 
num str_to_num(arg);
    
    
set_pcvar_num(mp_freezetimenum);
    
    new 
adminname[32]
    
get_user_name(plrname31)
    
    
client_print(0print_chat"ADMIN %s: set cvar mp_freezetime to %i"adminnamenum)
    
    return 
PLUGIN_HANDLED;

Emilioneri is offline
Send a message via Skype™ to Emilioneri
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-08-2009 , 15:22   Re: Chat print help.
Reply With Quote #8

Quote:
Originally Posted by Cretu View Post
QUESTION 2 : How i add a wait period in a plugin ? Because I done this :

client_cmd (print_chat;wait;wait;snapshot;wait;wait;)
server_cmd (around 40 waits here)
server_cmd (ban client) .

Is there a special line for those waits ? lie in stead of using 40 waits like that just type : server_wait_20_seconds )
Use set_task(20.0, "function", id)
__________________
fysiks is offline
Cretu
Member
Join Date: Mar 2009
Old 06-09-2009 , 02:10   Re: Chat print help.
Reply With Quote #9

Quote:
Originally Posted by fysiks View Post
Use set_task(20.0, "function", id)
Thank you for you`r reply .

set_task(22.0,"wait",id) , and this will execute wait function 22 times ?



PHP Code:
/home/groups/amxmodx/tmp3/text8xL7Lb.sma(30) : error 017undefined symbol "name"
/home/groups/amxmodx/tmp3/text8xL7Lb.sma(30) : warning 215expression has no effect
/home/groups/amxmodx/tmp3/text8xL7Lb.sma(30) : error 001expected token";"but found ")"
/home/groups/amxmodx/tmp3/text8xL7Lb.sma(30) : error 029invalid expressionassumed zero
/home/groups/amxmodx/tmp3/text8xL7Lb.sma(30) : fatal error 107too many error messages on one line

Compilation aborted
.
4 Errors
I don`t think that is the way to do it, Emilioneri . Any other ideea, please ?
Cretu is offline
ehha
SourceMod Donor
Join Date: Apr 2006
Location: Sibiu
Old 06-09-2009 , 05:18   Re: Chat print help.
Reply With Quote #10

No, set_task(22.0, "function") will execute function after 22 seconds.
Function is a function not a command like wait.
For example CmdFreezetime is a function in your code, not a command.
ehha 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 15:36.


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