AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Plugin message... (https://forums.alliedmods.net/showthread.php?t=223002)

AtomicServers 08-08-2013 18:45

Plugin message...
 
Hello everyone! I want to ask for help with message code. I want to put a message in a plugin that all players will see on every 30 seconds but I don't know how and what is the code I should put into plugin. I'm new here, still learning! :)

Example of plugin message:
To restart your score write /rs.

30 seconds later:
To restart your score write /rs.

I hope you got my question. Waiting for answers! :P

Black Rose 08-08-2013 20:22

Re: Plugin message...
 
Really simple example.
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Advertise", "", "");     set_task(30.0, "advertise", 123509812, _, _, "b"); // This calls the function "advertise" on set time (30 seconds in this case). The "b" flag loops it forever. } public advertise() {     client_print(0, print_chat, "To restart your score write /rs."); // This prints a chat message to everyone. }

ironskillz1 08-08-2013 20:32

Re: Plugin message...
 
Quote:

Originally Posted by Black Rose (Post 2008994)
Really simple example.
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Advertise", "", "");     set_task(30.0, "advertise", 123509812, "b"); // This calls the function "advertise" on set time (30 seconds in this case). The "b" flag loops it forever. } public advertise() {     client_print(0, print_chat, "To restart your score write /rs."); // This prints a chat message to everyone. }

Bad way you should set_task at connect
And only show for id and not evryone

Doc-Holiday 08-08-2013 21:27

Re: Plugin message...
 
Quote:

Originally Posted by ironskillz1 (Post 2008998)
Bad way you should set_task at connect
And only show for id and not evryone

or say it on spawn or hooking chat and checking for certain words.


spawn would be best...

as 32 timers isnt the best way

Black Rose 08-08-2013 23:06

Re: Plugin message...
 
Quote:

Originally Posted by ironskillz1 (Post 2008998)
Bad way you should set_task at connect
And only show for id and not evryone

Why?

ConnorMcLeod 08-09-2013 00:28

Re: Plugin message...
 
flags argument position is wrong, or you have forgotten to named it ;)

zi443r 08-09-2013 00:31

Re: Plugin message...
 
this will do the trick: https://forums.alliedmods.net/showthread.php?t=27814

Black Rose 08-09-2013 07:39

Re: Plugin message...
 
Quote:

Originally Posted by ConnorMcLeod (Post 2009064)
flags argument position is wrong, or you have forgotten to named it ;)

:stupid:

Fixed.


All times are GMT -4. The time now is 15:49.

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