Raised This Month: $404 Target: $400
 101% 

Solved Error 159


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Enes05
Junior Member
Join Date: Feb 2018
Location: Istanbul | Turkey
Old 10-08-2018 , 17:08   Error 159
Reply With Quote #1

PHP Code:
public void OnPluginStart()
{
    
AddCommandListener(OnSayCmd"say");
    
AddCommandListener(OnSayCmd"say_team");
}

public 
Action OnSayCmd(int clientchar command[], int argc)
{
    
char sArgs[256];
    
GetCmdArg(1sArgssizeof(sArgs));
    
char name[32];
    
GetClientName(clientnamesizeof(name));

    if (!
strcmp(sArgs"hi"true))
    {
        
FakeClientCommand(client"say Hello");

    }

Error in the:
PHP Code:
public Action OnSayCmd(int clientchar command[], int argc
Error is: error 159: brackets after variable name indicate a fixed-size array, but size could not be determined - either specify sizes, an array initializer, or use dynamic syntax (such as 'char[] x')

How to fix this error?

Last edited by Enes05; 10-09-2018 at 13:59.
Enes05 is offline
Crasher_3637
AlliedModders Donor
Join Date: May 2012
Old 10-08-2018 , 17:24   Re: Error 159
Reply With Quote #2

Change char command[] to char[] command
__________________
AFK like JFK
Crasher_3637 is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 10-08-2018 , 18:45   Re: Error 159
Reply With Quote #3

Instead of using AddCommandListener for say / say_team you should just use OnClientSayCommand

Where command is either say or say_team and sArgs contains the whole message

Last edited by xerox8521; 10-08-2018 at 18:45.
xerox8521 is offline
mug1wara
AlliedModders Donor
Join Date: Jun 2018
Location: Not your business.
Old 10-09-2018 , 14:08   Re: Error 159
Reply With Quote #4

Quote:
Originally Posted by xerox8521 View Post
Instead of using AddCommandListener for say / say_team you should just use OnClientSayCommand

Where command is either say or say_team and sArgs contains the whole message
Both are command listeners and do pretty much the same, altough on AddCommandListener you pass the command as one of the parameters, where as on OnClientSayCommand, you'd still have to run a check for the command that has been runned.

EDIT:

I know the thread has been solved and that this is irrelevant, just had to say it.
__________________
Taking requests, add me on Steam.

mug1wara.xyz

People make themselves understood in a way, others understand in another.

Last edited by mug1wara; 10-09-2018 at 14:10.
mug1wara 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 17:10.


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