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

Return value for PrintToChatAll ?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
roohsavar
Junior Member
Join Date: Jun 2013
Location: IRAN
Old 09-05-2019 , 14:45   Return value for PrintToChatAll ?
Reply With Quote #1


Hi Guys ,

Is code editing correct?
And
What can be the return value?

PHP Code:

void PrintToChatAll
(String:format[])
{
    new 
String:buffer[256];
    new 
1;
    while (
<= MaxClients)
    {
        if (
IsClientInGame(i))
        {
            
SetGlobalTransTarget(i);
            
VFormat(buffer254format2);
            
PrintToChat(i"%s"buffer);
        }
        
i++;
    }
    return  ? ;

roohsavar is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 09-05-2019 , 15:51   Re: Return value for PrintToChatAll ?
Reply With Quote #2

"void" methods doesn't return anything. So you should remove the "return..." snippet line
Also you shoud'nt print to bots, since they don't "read"
__________________
Marttt is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 09-05-2019 , 19:36   Re: Return value for PrintToChatAll ?
Reply With Quote #3

...just use the version of PrintToChatAll that exists in the SourceMod API.

Edit: If you really want to know what the code for PrintToChatAll looks like:

PHP Code:
stock void PrintToChatAll(const char[] formatany ...)
{
    
char buffer[254];
    
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
SetGlobalTransTarget(i);
            
VFormat(buffersizeof(buffer), format2);
            
PrintToChat(i"%s"buffer);
        }
    }

__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 09-05-2019 at 19:38.
Powerlord is offline
roohsavar
Junior Member
Join Date: Jun 2013
Location: IRAN
Old 09-06-2019 , 11:10   Re: Return value for PrintToChatAll ?
Reply With Quote #4

Quote:
Originally Posted by Marttt View Post
"void" methods doesn't return anything. So you should remove the "return..." snippet line
Also you shoud'nt print to bots, since they don't "read"
it's true . Error fixed after deletion
roohsavar is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 09-07-2019 , 06:25   Re: Return value for PrintToChatAll ?
Reply With Quote #5

Quote:
Originally Posted by Marttt View Post
Also you shoud'nt print to bots, since they don't "read"
SourceTV / Replay do, along with some 3rd party bot frameworks, which is why they're included in PrintToChatAll.

Anyway, this is just lysis decompiled code - just remove it and use the SM stock.
__________________
asherkin is offline
roohsavar
Junior Member
Join Date: Jun 2013
Location: IRAN
Old 09-07-2019 , 14:32   Re: Return value for PrintToChatAll ?
Reply With Quote #6

Quote:
Originally Posted by Powerlord View Post
...just use the version of PrintToChatAll that exists in the SourceMod API.

Edit: If you really want to know what the code for PrintToChatAll looks like:

PHP Code:
stock void PrintToChatAll(const char[] formatany ...)
{
    
char buffer[254];
    
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
SetGlobalTransTarget(i);
            
VFormat(buffersizeof(buffer), format2);
            
PrintToChat(i"%s"buffer);
        }
    }

I found out later. Thanks again for your re-tell <3
roohsavar is offline
Reply


Thread Tools
Display Modes

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 13:40.


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