AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Return value for PrintToChatAll ? (https://forums.alliedmods.net/showthread.php?t=318533)

roohsavar 09-05-2019 14:45

Return value for PrintToChatAll ?
 

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  ? ;



Marttt 09-05-2019 15:51

Re: Return value for PrintToChatAll ?
 
"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"

Powerlord 09-05-2019 19:36

Re: Return value for PrintToChatAll ?
 
...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);
        }
    }



roohsavar 09-06-2019 11:10

Re: Return value for PrintToChatAll ?
 
Quote:

Originally Posted by Marttt (Post 2666005)
"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

asherkin 09-07-2019 06:25

Re: Return value for PrintToChatAll ?
 
Quote:

Originally Posted by Marttt (Post 2666005)
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.

roohsavar 09-07-2019 14:32

Re: Return value for PrintToChatAll ?
 
Quote:

Originally Posted by Powerlord (Post 2666026)
...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 :3


All times are GMT -4. The time now is 01:27.

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