Raised This Month: $ Target: $400
 0% 

Say command print chat & set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
4ever16
Veteran Member
Join Date: Apr 2015
Old 09-03-2015 , 07:51   Say command print chat & set_task
Reply With Quote #1

I know this is really easiy one but i cant code at all.
I have tryed different plugins but it only prints 1 time.
The problem i found is that print action is forced all at once and taht makes that only print 1 time cause the actions is happening so fast.

client_cmd(say lol)
client_cmd(say lol)
client_cmd(say lol)

Like i sed it only prints 1 time because i think these 3 actions happens so fast.

So i would need some say command that prints 4 times the solution is to solve it by setting set_task between prints.

set_task(0.0)
client_cmd(say lol)
set_task(1.0)
client_cmd(say lol)
set_task(2.0)
client_cmd(say lol)

Reffered to this request. https://forums.alliedmods.net/showthread.php?t=270939
4ever16 is offline
redivcram
Veteran Member
Join Date: Jul 2014
Location: Serbia
Old 09-03-2015 , 08:38   Re: Say command print chat & set_task
Reply With Quote #2

Use the for loop
I'm no pro, but this might help you... and remove the "set_task"s


PHP Code:
public urfunction(id)
{
    new 
//We need this variable for the "for" loop
    
    
for(04i++)
    {
        
client_cmd(id"say lol")
    }
    
    
/* For loop:
    First parameter sets "i"'s value to 0
    Second parameter tells when to repeatedly print out "lol" (in this case while "i"'s value is less than 4
    Third parameter adds up "i"'s value by 1
    
    So when it adds up to 4, it will stop printing out "lol"
    You have to be careful when making loops, you can crash your server
    */
    
    
return PLUGIN_HANDLED


Last edited by redivcram; 09-03-2015 at 08:39.
redivcram is offline
4ever16
Veteran Member
Join Date: Apr 2015
Old 09-03-2015 , 13:33   Re: Say command print chat & set_task
Reply With Quote #3

Ok how to add print in the script u wrote?

client_cmd(id,"say_team lol")
4ever16 is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 09-03-2015 , 14:53   Re: Say command print chat & set_task
Reply With Quote #4

Quote:
Originally Posted by 4ever16 View Post
Ok how to add print in the script u wrote?

client_cmd(id,"say_team lol")
nope
Code:
client_print(id, print_chat, "[AMXX] Your Text Here.");
i dunno if you can use id but try

Last edited by Fuck For Fun; 09-03-2015 at 14:54.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
4ever16
Veteran Member
Join Date: Apr 2015
Old 09-03-2015 , 18:01   Re: Say command print chat & set_task
Reply With Quote #5

Solved it: client_cmd(0, "say_team B B B;wait;say_team B B B;wait;say_team B B B")
4ever16 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-03-2015 , 21:00   Re: Say command print chat & set_task
Reply With Quote #6

Quote:
Originally Posted by redivcram View Post
Use the for loop
I'm no pro, but this might help you... and remove the "set_task"s
No. A for loop will execute just as fast as multiples of the same command one after the other.

Quote:
Originally Posted by 4ever16 View Post
Solved it: client_cmd(0, "say_team B B B;wait;say_team B B B;wait;say_team B B B")
This will not work for anybody that is using cl_filterstuffcmd 1 FYI (and everybody should have this set to 1, IMO).

The proper way would be to use set_task() with engclient_cmd() like so:

PHP Code:
public function(id)
{
    
set_task(0.2"saycommand"id)
}

public 
saycommand(id)
{
    
engclient_cmd(id"say_team""lol")

__________________

Last edited by fysiks; 09-03-2015 at 21:01.
fysiks 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 22:12.


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