Raised This Month: $ Target: $400
 0% 

Advertisments with more than one Line


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CFN|Toky
Junior Member
Join Date: Jun 2006
Old 05-10-2007 , 10:48   Advertisments with more than one Line
Reply With Quote #1

Hi!

I already tried to do it by myself ( I am a c++ programmer ) but I can't do it ->

I want the plugin ad_manager.sma to support advertisements with more than 1 line f.e. by using \n to start a new line.

Problem: Some people already asked the coder of the plugin but he doesn't add this function.

This is the code of the output function. I think the only thing to do is a query to look up if the message contains a \n and if there is one in it to break the line at this point by splitting it in more messages (max 5).

THX for help!

Code:
public displayAd(params[])
{
    //Get the string that is going to be displayed
    new message[128];
    getString(STORE, params[1], message, 127, params[0], params[1]);
    
    //If its enabled by cvar and id is set, display to person who triggered message only
    if(get_cvar_num("ad_react_all") == 0 && params[2] != 0)
    {
        message_begin(MSG_ONE, gmsgSayText, {0,0,0}, params[2]);
        write_byte(params[2]);
        write_string(message);
        message_end();
    
    } else
    {
        //Display the message to everyone
        new plist[32], playernum, player;
        
        get_players(plist, playernum, "c");
    
        for(new i = 0; i < playernum; i++)
        {
            player = plist[i];
            
            message_begin(MSG_ONE, gmsgSayText, {0,0,0}, player);
            write_byte(player);
            write_string(message);
            message_end();
        }
    }
    
    return PLUGIN_HANDLED;
}
__________________
Regards/Gruß CFN|Toky
Administrator Clanforums Network - www.clanforums.com


Last edited by CFN|Toky; 05-10-2007 at 10:51.
CFN|Toky is offline
Send a message via ICQ to CFN|Toky Send a message via MSN to CFN|Toky Send a message via Skype™ to CFN|Toky
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 05-10-2007 , 15:06   Re: Advertisments with more than one Line
Reply With Quote #2

The answer is quite simple: Just break up the message into two strings and output them seperately.
The new version will be coming up, don't worry
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
CFN|Toky
Junior Member
Join Date: Jun 2006
Old 05-10-2007 , 15:59   Re: Advertisments with more than one Line
Reply With Quote #3

OK Thx
Maybe I can test the Betas
__________________
Regards/Gruß CFN|Toky
Administrator Clanforums Network - www.clanforums.com

CFN|Toky is offline
Send a message via ICQ to CFN|Toky Send a message via MSN to CFN|Toky Send a message via Skype™ to CFN|Toky
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 06:41.


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