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

zp_colored_print => include file


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Mlk27
Veteran Member
Join Date: May 2008
Old 03-13-2009 , 02:11   zp_colored_print => include file
Reply With Quote #1

Can someone please show me how to add this function into ZP include file, along with other changes I need to make in zp core source?
Mlk27 is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 03-13-2009 , 04:57   Re: zp_colored_print => include file
Reply With Quote #2

Make a native returning the stock from the plugin? hmm..
__________________
IneedHelp is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 03-13-2009 , 05:48   Re: zp_colored_print => include file
Reply With Quote #3

Yea something like that. Since most zp plugins use ZP include, I want the function to be included in the file as well so I could use it to add coloured messages in ZP plugins
Mlk27 is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 03-25-2009 , 18:46   Re: zp_colored_print => include file
Reply With Quote #4

Mercylezz, if you see this topic, could you please reply here?
Mlk27 is offline
G-Dog
Senior Member
Join Date: Dec 2005
Location: Thunderstorm Central
Old 03-26-2009 , 06:08   Re: zp_colored_print => include file
Reply With Quote #5

at the bottom of you zombieplague.inc add
PHP Code:
stock zp_colored_print(target, const message[], any:...)
{
    static 
msgSayTextmaxplayers;
    if ( !
g_msgSayText )
        
g_msgSayText get_user_msgid("SayText");
        
    if ( !
maxplayers )
        
maxplayers get_maxplayers();
        
    static 
buffer[512], iargscount;
    
argscount numargs();
    
    
// Send to everyone
    
if (!target)
    {
        static 
player;
        for (
player 1player <= maxplayersplayer++)
        {
            
// Not connected
            
if (!is_user_connected(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(buffersizeof buffer 1message3);
            
            
// Send it
            
message_begin(MSG_ONE_UNRELIABLEmsgSayText_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(buffersizeof buffer 1message3);
        
        
// Send it
        
message_begin(MSG_ONEmsgSayText_target);
        
write_byte(target);
        
write_string(buffer);
        
message_end();
    }

__________________
If at first you don't succeed, then skydiving isn't for you.

Last edited by G-Dog; 03-27-2009 at 04:17. Reason: fixed the issue with g_maxplayers
G-Dog is offline
Send a message via AIM to G-Dog
alan_el_more
Veteran Member
Join Date: Jul 2008
Location: amxmodx-es.com
Old 03-26-2009 , 08:38   Re: zp_colored_print => include file
Reply With Quote #6

instead of using client_print, does the following:

First adds the include colorchat, so:

PHP Code:
#include <colorchat> 
After replaces this
PHP Code:
client_print(idprint_chat"[ZP] Hi!"
for this:
PHP Code:
ColorChat(idGREEN"[ZP] ^x04HI!^x01"
^x01 serves to start a message in yellow
^x03 serves to start a message in the color depends on your team, for example: if you are terrorist is red, CT: blue and spec: grey
^x04 serves to start a message in green

and finally download the include and place him in the folder scripting/include
__________________
alan_el_more is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 03-26-2009 , 10:07   Re: zp_colored_print => include file
Reply With Quote #7

I know about colorchat but my point of requesting to include the zp_colored_print in the zp include file is that so I dont need to add another include file just to have my zp plugins printed green messages

Cheers!
Mlk27 is offline
IneedHelp
Veteran Member
Join Date: Mar 2007
Location: Argentina
Old 03-26-2009 , 12:25   Re: zp_colored_print => include file
Reply With Quote #8

Do it like G-Dog said.
__________________
IneedHelp is offline
Mlk27
Veteran Member
Join Date: May 2008
Old 03-26-2009 , 15:27   Re: zp_colored_print => include file
Reply With Quote #9

G-Dog, there's an error with g_maxplayers in that include.

error 017: undefined symbol "g_maxplayers"
Mlk27 is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 03-26-2009 , 15:31   Re: zp_colored_print => include file
Reply With Quote #10

Quote:
Originally Posted by Mlk27 View Post
G-Dog, there's an error with g_maxplayers in that include.

error 017: undefined symbol "g_maxplayers"
It's because it's from ZP, so there was g_maxplayers already cause it was used for many other things. Basically you can just:
Code:
new max_players = get_maxplayers();
//Then use it in the loop
SnoW is offline
Send a message via MSN to SnoW
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 18:06.


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