Making chat easier

Results 1 to 19 of 19
  1. #1
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Making chat easier

    Code:
    void George::GameChat(bool bTeam, char* szMsg, ...)
    {
    	if(!ZGetGame())  return;
    
    	char szInput[4096];
    	va_list pArgs;
    	va_start(pArgs, szMsg);
    	vsprintf(szInput, szMsg, pArgs);
    	va_end(pArgs);
    
    	int nMyTeam = ZGetGame()->m_pMyCharacter->GetTeamID();
    	if(bTeam)
    		ZPostPeerChat(szInput,nMyTeam);
    	else
    		ZPostPeerChat(szInput,0);
    }
    Code:
    class George {
    public:
    	static void GameChat(bool bTeam, char* szMsg, ...);
    };
    Example
    Code:
    void ChatCmd_1(const char* line, const int argc, char **const argv)
    {
    	George::GameChat(true,"%d",(int)ZGetGame()->m_pMyCharacter->GetHP()); //Team Chat
    	George::GameChat(false,"%d",(int)ZGetGame()->m_pMyCharacter->GetHP());//Normal Chat
    }
    Last edited by qet123; 28-11-12 at 01:40 PM.


  2. #2
    Account Upgraded | Title Enabled! ofiritsmeeee is offline
    MemberRank
    Sep 2011 Join Date
    274Posts

    Re: Making chat easier

    Thanks , can't you post a tutorial about adding your commands here ? :
    [Release] Commands - RaGEZONE forums
    else u don't know how.

  3. #3
    Retired. Don't PM. SecretsOThePast is offline
    DeveloperRank
    Jan 2009 Join Date
    643Posts

    Re: Making chat easier

    This just makes it more complex. Thanks for the laugh, though.

  4. #4
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Making chat easier

    Quote Originally Posted by SecretsOThePast View Post
    This just makes it more complex.
    that's the point uhhhhh. about what you're laughing?

  5. #5
    Account Upgraded | Title Enabled! Wish Q is offline
    MemberRank
    Jul 2012 Join Date
    LiveScoreLocation
    456Posts

    Re: Making chat easier

    this do?

  6. #6
    Yaaay! Tannous is offline
    MemberRank
    Jul 2012 Join Date
    KonohaLocation
    840Posts

    Re: Making chat easier

    O.o I didn't actually understand what does it do exactly O.o !

  7. #7
    Developer / Patch Finder Tankado is offline
    MemberRank
    Oct 2011 Join Date
    The NetherlandsLocation
    451Posts

    Re: Making chat easier

    this coded,

    will give you 2 options for make GameChat (texten in game )

    GameChat new way to add Text,


    George::GameChat(true,"test");

    the true for enable Team Chat,
    the false for enable Normal Chat,

    this coded is written in a new class,

    Namespace = George (change it or make new header file like Goerge)

  8. #8
    Wait wut PenguinGuy is offline
    MemberRank
    Apr 2010 Join Date
    United StatesLocation
    765Posts

    Re: Making chat easier

    So, er, why didn't you just make a 'global function' instead? Just because you have the power to use OOP, doesn't mean you should use it for everything. Anyway, some improvements.

    1) You don't need the bool parameter, there's a member in ZGame (? I think it was ZGame lol, ZGameClient? xd) you could just check.
    ZPostPeerChat( szMsg, ZGetGame()->IsTeamGame() ? ZGetGame()->m_pMyCharacter->GetTeamID() : 0 ); //Remember to check if you are in game first.

    2) You have access to everything, Qet. Make it globally usable. ZPostChannelChat, ZPostStageChat, etc.
    if( ZGetStage() && ZGetStage()->GetState() != STAGESTATE_GAME ) // or w/e I don't fucking remember lol
    ZPostStageChat( crap );

  9. #9
    Account Upgraded | Title Enabled! Wish Q is offline
    MemberRank
    Jul 2012 Join Date
    LiveScoreLocation
    456Posts

    Re: Making chat easier

    Quote Originally Posted by PenguinGuy View Post
    So, er, why didn't you just make a 'global function' instead? Just because you have the power to use OOP, doesn't mean you should use it for everything. Anyway, some improvements.

    1) You don't need the bool parameter, there's a member in ZGame (? I think it was ZGame lol, ZGameClient? xd) you could just check.
    ZPostPeerChat( szMsg, ZGetGame()->IsTeamGame() ? ZGetGame()->m_pMyCharacter->GetTeamID() : 0 ); //Remember to check if you are in game first.

    2) You have access to everything, Qet. Make it globally usable. ZPostChannelChat, ZPostStageChat, etc.
    if( ZGetStage() && ZGetStage()->GetState() != STAGESTATE_GAME ) // or w/e I don't fucking remember lol
    ZPostStageChat( crap );
    good tutorial in 2 years

  10. #10
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Making chat easier

    Code:
    ZPostPeerChat(ZGetGame()->m_pMyCharacter->GetTeamID(), "you didnt make it easier.");

  11. #11
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Making chat easier

    Quote Originally Posted by Vusion View Post
    Code:
    ZPostPeerChat(ZGetGame()->m_pMyCharacter->GetTeamID(), "you didnt make it easier.");
    I did.

  12. #12
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Making chat easier

    Quote Originally Posted by qet123 View Post
    I did.
    Let's declare a whole new class to call functions that are already there!

  13. #13
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Making chat easier

    Quote Originally Posted by Vusion View Post
    Let's declare a whole new class to call functions that are already there!
    Can't see any problem in that!

  14. #14
    Hi, I'm Omar! Vusion is offline
    MemberRank
    Jan 2011 Join Date
    HereLocation
    1,658Posts

    Re: Making chat easier

    Quote Originally Posted by qet123 View Post
    Can't see any problem in that!
    Slower.

  15. #15
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: Making chat easier

    Code:
    ZGetGame()->m_pMyCharacter->GetTeamID() ? ZPostPeerChat(ZGetGame()->m_pMyCharacter->GetTeamID() "lala") : ZPostPeerChat(0, "lala");

  16. #16
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Making chat easier

    Quote Originally Posted by ThePhailure772 View Post
    Code:
    ZGetGame()->m_pMyCharacter->GetTeamID() ? ZPostPeerChat(ZGetGame()->m_pMyCharacter->GetTeamID() "lala") : ZPostPeerChat(0, "lala");
    now that's easier? tell me more about it please

  17. #17
    Praise the Sun! Solaire is offline
    MemberRank
    Dec 2007 Join Date
    Undead BurgLocation
    2,862Posts

    Re: Making chat easier

    Quote Originally Posted by qet123 View Post
    now that's easier? tell me more about it please
    Single Line If Statement in C# | Digital Colony

  18. #18
    Good Guy George qet123 is offline
    MemberRank
    Apr 2009 Join Date
    DesertLocation
    1,432Posts

    Re: Making chat easier

    Quote Originally Posted by Wizkidje View Post
    Ik that. And my code easier.

  19. #19
    Mako is insane. ThePhailure772 is offline
    MemberRank
    Sep 2007 Join Date
    1,115Posts

    Re: Making chat easier

    Quote Originally Posted by qet123 View Post
    Ik that. And my code easier.
    How is your source any better? You're making a useless class which requires more CPU instructions. You're an idiot, just stop releasing shitty things here and go learn how to actually program.



Advertisement