Raised This Month: $ Target: $400
 0% 

script problem, help please?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
piMpiN
Junior Member
Join Date: Sep 2005
Old 09-23-2007 , 00:56   script problem, help please?
Reply With Quote #1

Hey guys, I'm new to scripting and I thought I'd start off really easy but I guess I went the wrong way when creating this plugin?

I'm making a plugin to display a msg every couple of minutes or so, it's just not working. Help please!


/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Ads"
#define VERSION "1.0"
#define AUTHOR "nuki"

public plugin_init()
register_plugin(PLUGIN, VERSION, AUTHOR)

public client_authorized(id)
{
set_task(400.0, "PrintText", id = "0", repeat = "b")
}
public PrintText(id)
{
client_print(id, print_chat, "Message that will be displayed")
}

Thanks
piMpiN is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-23-2007 , 01:08   Re: script problem, help please?
Reply With Quote #2

-edited-

Last edited by ConnorMcLeod; 09-23-2007 at 03:32. Reason: bad code
ConnorMcLeod is offline
Lord_Destros
Veteran Member
Join Date: Jul 2004
Location: With stupid.
Old 09-23-2007 , 01:29   Re: script problem, help please?
Reply With Quote #3

Code:
#include <amxmodx> #define PLUGIN "Ads" #define VERSION "1.0" #define AUTHOR "nuki" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     set_task(10.0,"PrintText", 0,_,_, "b") } public PrintText(id) {     client_print(id, print_chat, "Message that will be displayed") }

The problem with the way connorr did it is that it prints the selected more rapidly based on how many people have joined the server (and theres no reason call it on client_putinserver unless you want it to display as soon as they enter).
__________________
Quote:
Originally Posted by Twilight Suzuka
Don't worry m'lord. The turtles day will come.

Last edited by Lord_Destros; 09-23-2007 at 01:32.
Lord_Destros is offline
Send a message via AIM to Lord_Destros
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 09-23-2007 , 01:32   Re: script problem, help please?
Reply With Quote #4

Sure, i was just thinking of that, after posted...

Either you do 1 task per player that basically is bad :
Code:
#include <amxmodx> #define PLUGIN "Ads" #define VERSION "1.0" #define AUTHOR "nuki" #define TASKID 123456 public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public client_connect(id) {     set_task(400.0, "PrintText", id+TASKID, _, _, "b") } public client_disconnect(id) {     remove_task(id+TASKID) } public PrintText(id) {     id -= TASKID     client_print(id, print_chat, "Message that will be displayed") }

either you make only 1 task for all players that is better :
Code:
#include <amxmod> #define PLUGIN "Ads" #define VERSION "1.0" #define AUTHOR "nuki" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR) } public plugin_cfg() {     set_task(400.0, "PrintText", _, _, _, "b") } public PrintText() {     client_print(0, print_chat, "Message that will be displayed") }

Last edited by ConnorMcLeod; 09-23-2007 at 03:41.
ConnorMcLeod is offline
piMpiN
Junior Member
Join Date: Sep 2005
Old 09-23-2007 , 11:14   Re: script problem, help please?
Reply With Quote #5

That's great, Thanks guys... I see the mistake I made, you guys rock!
piMpiN 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 16:11.


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