AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [HELP] Cvar Change Message in Colors (https://forums.alliedmods.net/showthread.php?t=310604)

shehzad1234 09-11-2018 15:53

[HELP] Cvar Change Message in Colors
 
3 Attachment(s)
can someone please add colors in this code please. ??

want to color this line :-
PHP Code:

show_activity_id(iidname"%L"i"SET_CVAR_TO"""argcvar_val); 

code :-

PHP Code:

public cmdCvar(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_HANDLED
    
    
new arg[32], arg2[64]
    
    
read_argv(1arg31)
    
read_argv(2arg263)
    
    new 
pointer;
    
    if (
equal(arg"add") && (get_user_flags(id) & ADMIN_RCON))
    {
        if ((
pointer=get_cvar_pointer(arg2))!=0)
        {
            new 
flags=get_pcvar_flags(pointer);
            
            if (!(
flags FCVAR_PROTECTED))
            {
                
set_pcvar_flags(pointer,flags FCVAR_PROTECTED);
            }
        }
        return 
PLUGIN_HANDLED
    
}
    
    if ((
pointer=get_cvar_pointer(arg))==0)
    {
        
console_print(id"[AMXX] %L"id"UNKNOWN_CVAR"arg)
        return 
PLUGIN_HANDLED
    
}
    
    if (
onlyRcon(arg) && !(get_user_flags(id) & ADMIN_RCON))
    {
        
// Exception for the new onlyRcon rules:
        //   sv_password is allowed to be modified by ADMIN_PASSWORD
        
if (!(equali(arg,"sv_password") && (get_user_flags(id) & ADMIN_PASSWORD)))
        {
            
console_print(id"[AMXX] %L"id"CVAR_NO_ACC")
            return 
PLUGIN_HANDLED
        
}
    }
    
    if (
read_argc() < 3)
    {
        
get_pcvar_string(pointerarg263)
        
console_print(id"[AMXX] %L"id"CVAR_IS"argarg2)
        return 
PLUGIN_HANDLED
    
}

    new 
authid[32], name[32]
    
    
get_user_authid(idauthid31)
    
get_user_name(idname31)
    
    
log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")"nameget_user_userid(id), authidargarg2)
    
set_cvar_string(argarg2)
    
    
    
// Display the message to all clients

    
new cvar_val[64];
    new 
maxpl get_maxplayers();
    for (new 
1<= maxpli++)
    {
        if (
is_user_connected(i) && !is_user_bot(i))
        {
            if (
get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(arg"rcon_password"))
            {
                
formatex(cvar_valcharsmax(cvar_val), "*** %L ***"i"PROTECTED");
            }
            else
            {
                
copy(cvar_valcharsmax(cvar_val), arg2);
            }
            
show_activity_id(iidname"%L"i"SET_CVAR_TO"""argcvar_val);
        }
    }

    
console_print(id"[AMXX] %L"id"CVAR_CHANGED"argarg2)
    
    return 
PLUGIN_HANDLED



Natsheh 09-11-2018 16:07

Re: [HELP] Cvar Change Message in Colors
 
Go to show_activity_id function replace the client_print(index, print_chat... Native with your crom include stock.

OciXCrom 09-11-2018 17:03

Re: [HELP] Cvar Change Message in Colors
 
No, don't replace anything. Simply add #include <cromchat> to the code and you're done. Just add the color symbols in the language file.

shehzad1234 09-11-2018 17:58

Re: [HELP] Cvar Change Message in Colors
 
Quote:

Originally Posted by OciXCrom (Post 2614772)
No, don't replace anything. Simply add #include <cromchat> to the code and you're done. Just add the color symbols in the language file.

PHP Code:

    new cvar_val[64];
    new 
maxpl get_maxplayers();
    for (new 
1<= maxpli++)
    {
        if (
is_user_connected(i) && !is_user_bot(i))
        {
            if (
get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(arg"rcon_password"))
            {
                
formatex(cvar_valcharsmax(cvar_val), "*** %L ***"i"PROTECTED");
            }
            else
            {
                
copy(cvar_valcharsmax(cvar_val), arg2);
            }
            
CromChat(iidname"%L"i"SET_CVAR_TO"""argcvar_val);
        }
    } 

error
Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

Error: Argument type mismatch (argument 2) on line 752

1 Error.
Could not locate output file D:\Steam\steamapps\common\Half-Life\cstrike\addons\amxmodx\scripting\admincmd.amx (compile failed).


OciXCrom 09-11-2018 18:21

Re: [HELP] Cvar Change Message in Colors
 
I said don't change anything in the .sma file.

shehzad1234 09-13-2018 16:05

Re: [HELP] Cvar Change Message in Colors
 
Quote:

Originally Posted by OciXCrom (Post 2614786)
I said don't change anything in the .sma file.

can u edit that plugin i really tried to give my best its not working please help brother.

OciXCrom 09-13-2018 16:16

Re: [HELP] Cvar Change Message in Colors
 
I can't say it any clearer - DO NOT EDIT ANYTHING IN THE PLUGIN EXCEPT ADDING #include <cromchat>. Make sure you have the latest cromchat version.

shehzad1234 09-13-2018 17:18

Re: [HELP] Cvar Change Message in Colors
 
Quote:

Originally Posted by OciXCrom (Post 2615098)
I can't say it any clearer - DO NOT EDIT ANYTHING IN THE PLUGIN EXCEPT ADDING #include <cromchat>. Make sure you have the latest cromchat version.

if i don't add #include <cromchat> then how i can add colors in plugin ;-;

Natsheh 09-13-2018 17:21

Re: [HELP] Cvar Change Message in Colors
 
Quote:

Originally Posted by shehzad1234 (Post 2615105)
if i don't add #include <cromchat> then how i can add colors in plugin ;-;

He told you just to add the include.

OciXCrom 09-13-2018 18:29

Re: [HELP] Cvar Change Message in Colors
 
Please open your eyes and read properly. I'm done explaining.


All times are GMT -4. The time now is 19:30.

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