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

How to add an identical arguments?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GanHUNTER
Junior Member
Join Date: Oct 2019
Old 10-21-2019 , 17:39   How to add an identical arguments?
Reply With Quote #1

Hello!
I have a problem.

In this line
PHP Code:
SourceComms_SetClientGag(idtrue120true"[GD] Insulting players (%s)"szBuffer[idx]); 
I receive an error when I will add szBuffer[idx]

PHP Code:
error 092:number of arguments does not match definition 

How can I increase the number of arguments so that I can add more than once szBuffer[idx]??



More code:
PHP Code:
public Action:ChatEvent(idargs)
{
    if(!(
id <=MaxClients))
    return 
Plugin_Continue;

    if(!
IsClientInGame(id))
        return 
Plugin_Continue;

    if(
SourceComms_GetClientGagType(id) != bNot)
        return 
Plugin_Continue;

    
decl String:szBuffer[191];
    
GetCmdArgString(szBuffersizeof(szBuffer));

    new 
idx 0;
    if (
szBuffer[0] == '"'){
        
idx 1;
        new 
len strlen(szBuffer);
        if (
szBuffer[len-1] == '"'){
                
szBuffer[len-1] = '\0';
        }
    }

    new 
0;
    new 
bool:found false;
    while (
g_ilosblokslowk)
    {
        if (
StrContains(szBuffer[idx], g_blokslowka[i], false) != -&& StrContains(szBuffer[idx], "xxx"false) == -1)
        {
            
found true;
            
LogToFile("Warnings.log""[Bad words] %N used the forbidden word %s"idszBuffer[idx]);
        }
        
i++;
    }

    if(
found)
    {
        if(
ilosc_ostrzezen[id] >= 3)
        {
            
CPrintToChat(id"★ {darkred}[GD] {lightgreen}You get {darkred}3 {lightgreen}warnings i GAG on {darkred}120 {lightgreen}minutes.");
            
SourceComms_SetClientGag(idtrue120true"[GD] Insulting players (%s)"szBuffer[idx]);
        }
        else
        {
            
ilosc_ostrzezen[id]++;
            
CPrintToChat(id"★ {darkred}[GD] {lightgreen}One of the words is prohibited on this server! You get a warning {darkred}[%d/3]"ilosc_ostrzezen[id]);
            
found true;

            if(
ilosc_ostrzezen[id] >= 3)
            {
                
CPrintToChat(id"★ {darkred}[GD] {lightgreen}You get {darkred}3 {lightgreen}warnings i GAG on {darkred}120 {lightgreen}minutes.");
                
SourceComms_SetClientGag(idtrue120true"[GD] Insulting players (%s)"szBuffer[idx]);
            }
        }
        return 
Plugin_Handled;
    }
    return 
Plugin_Continue;



Regards.

Last edited by GanHUNTER; 10-21-2019 at 17:57.
GanHUNTER is offline
Rohanlogs
Senior Member
Join Date: Nov 2015
Old 10-22-2019 , 08:20   Re: How to add an identical arguments?
Reply With Quote #2

Hello. Here is the native:
PHP Code:
 native bool:SourceComms_SetClientGag(clientbool:gagStategagLength = -1bool:saveToDB false, const String:reason[] = "Gagged through natives"); 
You are trying to format the gag reason in the function arguments which will not work because you're adding an extra argument which doesn't exist within the native.
So just make your gag reason into a string first, like this:
PHP Code:
char sWords[191];
FormatExsWordssizeof(sWords), "[GD] Insulting players (%s)"szBuffer[idx] ); 
Then just use that string in the function so it matches the arguments:
PHP Code:
SourceComms_SetClientGag(idtrue120truesWords); 
__________________
Rohanlogs is offline
GanHUNTER
Junior Member
Join Date: Oct 2019
Old 10-24-2019 , 16:48   Re: How to add an identical arguments?
Reply With Quote #3

Very thanks! Its working!
GanHUNTER 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 15:07.


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