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

PrintToChatAll help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jasonbourn48
Junior Member
Join Date: Nov 2009
Old 12-22-2009 , 17:27   PrintToChatAll help
Reply With Quote #1

A little introduction of myself first. My name is Vu and I'm new to this scripting thing. So I decided to start by editing some other people's codes. I downloaded AtomicStryker's laser plugin for L4D2. I was able to do some editing with it and it worked. It wasn't much. Now, I need to know how to make a chat announcement to all clients in server that they can use it. This is what I got:

stock PrintToChatAll(const String:format[])
{
PrintToChatAll("\x011[SM] You can type !laseron to get laser and !laseroff to turn laser off");
}

When I compiled it, i got the error that says "fatal error 021: symbol already defined: "PrintToChatAll". I wanna know what I did wrong here and I wanna know what "format" goes there. Thanks in advanced for any help.
jasonbourn48 is offline
meng
Veteran Member
Join Date: Oct 2005
Location: us
Old 12-22-2009 , 17:44   Re: PrintToChatAll help
Reply With Quote #2

like the error suggests, your creating a function with the same name as an already defined SM native. simply renaming it something unique should fix the error. also, if your just going to use that hard-coded message, there is no need for the String parameter.

PHP Code:
stock PrintMyMessage()
{
    
PrintToChatAll("\x011[SM] You can type !laseron to get laser and !laseroff to turn laser off");

if you wanted a more flexible function, you would include the String parameter.
PHP Code:
stock PrintMyMessage(String:MyString[])
{
    
PrintToChatAll("\x011[SM] %s"MyString);    

__________________
.
[ 1 Dumerils Boa | 1 Cali King ]...
.
I'm a lil' spirituous.
meng is offline
Send a message via Yahoo to meng
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-22-2009 , 17:58   Re: PrintToChatAll help
Reply With Quote #3

^ what he said.

Secondarily, what color does \x011 come out to be?
Dragonshadow is offline
jasonbourn48
Junior Member
Join Date: Nov 2009
Old 12-22-2009 , 19:21   Re: PrintToChatAll help
Reply With Quote #4

Thanks for the help guys...but how can I get it to show up when some1 joins my server?
jasonbourn48 is offline
jackpf
Senior Member
Join Date: Dec 2009
Location: Uhm...
Old 12-22-2009 , 20:27   Re: PrintToChatAll help
Reply With Quote #5

OnClientPutInServer() ?
jackpf is offline
jasonbourn48
Junior Member
Join Date: Nov 2009
Old 12-22-2009 , 20:56   Re: PrintToChatAll help
Reply With Quote #6

explain a bit more, sir?
jasonbourn48 is offline
Dragonshadow
BANNED
Join Date: Jun 2008
Old 12-22-2009 , 21:54   Re: PrintToChatAll help
Reply With Quote #7

Use OnClientPostAdminCheck() instead
Dragonshadow is offline
pheadxdll
AlliedModders Donor
Join Date: Jun 2008
Old 12-22-2009 , 22:11   Re: PrintToChatAll help
Reply With Quote #8

Quote:
Originally Posted by jasonbourn48 View Post
explain a bit more, sir?
Those are both functions that are ran when a user joins the server. Its easy to use them:

Code:
public OnClientPutInServer(client)
{
     // code here
}
public OnClientPostAdminCheck(client)
{
     // code here
}
It seems like the text you want to print, you want the user to see. So the trick is to use a function that is executed when the user can see the chat area. Between the above two functions, I'd go with OnClientPostAdminCheck.

It might turn out that the functions are ran too early and the player never sees the text. Then you might have to use a timer and wait 30 seconds, then show the message.
pheadxdll is offline
jasonbourn48
Junior Member
Join Date: Nov 2009
Old 12-22-2009 , 22:44   Re: PrintToChatAll help
Reply With Quote #9

so i put

public OnClientPostAdminCheck(client)
{
PrintToChatAll("\x011[SM] You can type !laseron to get laser and !laseroff to turn laser off");
}

Does that look about right to you guys? Sorry I'm reallllyy reeallly newww

nevermind, it works brilliantly. Thank you guys

Last edited by jasonbourn48; 12-22-2009 at 22:52.
jasonbourn48 is offline
FaTony
Veteran Member
Join Date: Aug 2008
Old 12-23-2009 , 06:31   Re: PrintToChatAll help
Reply With Quote #10

That code will print message to everyone, if you want only 1 player, you should use PrintToChat instead.
FaTony 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:30.


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