AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved print_color problem Oo (https://forums.alliedmods.net/showthread.php?t=325688)

Supremache 07-02-2020 18:11

print_color problem Oo
 
Hello guys,

I editing bb mod but i got something is stranger, i know some codes have transformed from zombie plague but i checked zp mod and i saw the same print color codes

My problem is: When i creat a new chat and add color, the colors didn't shows but it's only showing spaces betwen the words. But if i added modname of bb mod the colors be working :shock: can some one tell me what is the hell is this ?

Example:
Without MODNAME, Show Only Spaces:
PHP Code:

print_color(0"[ADMIN] ^x03%s ^1take ^x04%d ^1Ammo Packs from ^x03%s"szAdminNameiAmmoszPlayerName

With MODNAME, Working:
PHP Code:

print_color(0"%s [ADMIN] ^x03%s ^x01gave ^x04%d ^x01Ammo Packs to ^x03%s"MODNAMEszAdminNameiAmmoszPlayerName

//print color chat
PHP Code:

print_color(target, const message[], any:...)
{
    static 
buffer[512], iargscount
    argscount 
numargs()
    
    
// Send to everyone
    
if (!target)
    {
        static 
player
        
for (player 1player <= g_iMaxPlayersplayer++)
        {
            
// Not connected
            
if (!g_isConnected[player])
                continue;
            
            
// Remember changed arguments
            
static changed[5], changedcount // [5] = max LANG_PLAYER occurencies
            
changedcount 0
            
            
// Replace LANG_PLAYER with player id
            
for (2argscounti++)
            {
                if (
getarg(i) == LANG_PLAYER)
                {
                    
setarg(i0player)
                    
changed[changedcount] = i
                    changedcount
++
                }
            }
            
            
// Format message for player
            
vformat(buffercharsmax(buffer), message3)
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEg_msgSayText_player)
            
write_byte(player)
            
write_string(buffer)
            
message_end()
            
            
// Replace back player id's with LANG_PLAYER
            
for (0changedcounti++)
                
setarg(changed[i], 0LANG_PLAYER)
        }
    }
    
// Send to specific target
    
else
    {
        
// Format message for player
        
vformat(buffercharsmax(buffer), message3)
        
        
// Send it
        
message_begin(MSG_ONEg_msgSayText_target)
        
write_byte(target)
        
write_string(buffer)
        
message_end()
    }



Shadows Adi 07-02-2020 19:22

Re: print_color problem Oo
 
You need to begin your text with a color, idk why, but that's how it works.

PHP Code:

print_color(0"^x01%s [ADMIN] ^x03%s ^x01gave ^x04%d ^x01Ammo Packs to ^x03%s"MODNAMEszAdminNameiAmmoszPlayerName


Supremache 07-02-2020 19:37

Re: print_color problem Oo
 
Quote:

Originally Posted by Shadows Adi (Post 2708309)
You need to begin your text with a color, idk why, but that's how it works.

PHP Code:

print_color(0"^x01%s [ADMIN] ^x03%s ^x01gave ^x04%d ^x01Ammo Packs to ^x03%s"MODNAMEszAdminNameiAmmoszPlayerName


Oh, Okey thanks for help :)


All times are GMT -4. The time now is 17:12.

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