Context Menu Additions

Results 1 to 13 of 13
  1. #1
    Connoisseur of Fine Code SanGawku is offline
    ModeratorRank
    Oct 2006 Join Date
    CyberSpanksLocation
    645Posts

    talk Context Menu Additions

    Hey guys Here I impart some of my knowledge to you.
    The knowledge to add new context menus on the tab screen.


    Pretty simple actually,
    Replace your code in WarZ.sln->HUDDisplay.cpp starting at line 246.
    You want to replace the two functions
    void HUDDisplay::eventShowPlayerListContextMenu and
    void HUDDisplay::eventPlayerListAction

    Make them look like this.

    Code:
    void HUDDisplay::eventShowPlayerListContextMenu(r3dScaleformMovie* pMove, const Scaleform::GFx::Value* args, unsigned argCount)
    
    
    
    {
    
    
    /*
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", 2, "");
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", 3, "");
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", 4, "$HUD_PlayerAction_Kick");
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", 5, "$HUD_PlayerAction_Ban");
    */
    
    
    int isDev = gUserProfile.ProfileData.isDevAccount;
    Scaleform::GFx::Value var[3];
    
    
    
    
    if(isDev)
    {
    var[0].SetInt(2);
    var[1].SetString("WATCH PLAYER");
    var[2].SetInt(2);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(3);
    var[1].SetString("TELEPORT TO");
    var[2].SetInt(3);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(4);
    var[1].SetString("KICK PLAYER");
    var[2].SetInt(4);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(5);
    var[1].SetString("BAN ACCOUNT");
    var[2].SetInt(5);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    }
    else 
    {
    
    
    
    
    var[0].SetInt(6);
    var[1].SetString("HELP ME");
    var[2].SetInt(6);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(7);
    var[1].SetString("INVITE");
    var[2].SetInt(7);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(8);
    var[1].SetString("VOTE KICK");
    var[2].SetInt(8);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    
    
    
    
    var[0].SetInt(9);
    var[1].SetString("");
    var[2].SetInt(9);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    }
    
    
    
    
    gfxHUD.Invoke("_root.api.showPlayerListContextMenu", "");
    }
    
    
    void HUDDisplay::eventPlayerListAction(r3dScaleformMovie* pMove, const Scaleform::GFx::Value* args, unsigned argCount)
    {
        // REPORT
        // ""
        // ""
        // KICK
        // BAN
        int action = args[0].GetInt();
        const char* pName = args[1].GetString();
        char msg[128];
    
    
        sprintf(msg, "Action: %d, pName: %s", action, pName);
        addChatMessage(0, "system", msg, 0);
        // END Close the List
        if(action == 1)
        {
            showChatInput();
    
    
            char ffReport[128];
            sprintf(ffReport, "FairFight %s ", pName);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
    
    
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(ffReport);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
        if(action == 3)
        {
            showChatInput();
    
    
            char cmGoto[128];
            sprintf(cmGoto, "/goto %s ", pName);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
    
    
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(cmGoto);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
        if(action == 4)
        {
            showChatInput();
    
    
            char cmKick[128];
            sprintf(cmKick, "/kick %s ", pName);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
    
    
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(cmKick);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
        if(action == 5)
        {
            showChatInput();
    
    
            char cmBan[128];
            sprintf(cmBan, "/ban For.Hacking.Of.Some.Sort %s ", pName);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
    
    
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(cmBan);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
        if(action == 6)
        {
            showChatInput();
            obj_Player* plr = gClientLogic().localPlayer_;
            r3dPoint3D localpos = plr->GetPosition();
            char cmHelpme[128];
            sprintf(cmHelpme, "Please Help Me, %s I'm at %p  ", pName, localpos);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
            
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(cmHelpme);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
    }

    Thats all there is to it

    If you want to add more, just copy
    Code:
    var[0].SetInt(9);var[1].SetString("");
    var[2].SetInt(9);
    gfxHUD.Invoke("_root.api.setPlayerListContextMenuButton", var, 3);
    and

    Code:
    if(action == 6)    {
            showChatInput();
            obj_Player* plr = gClientLogic().localPlayer_;
            r3dPoint3D localpos = plr->GetPosition();
            char cmHelpme[128];
            sprintf(cmHelpme, "Please Help Me, %s I'm at %p  ", pName, localpos);
            //gfxHUD.Invoke("_root.api.setChatActive", ffReport);
            
            chatVisible = true;
            Scaleform::GFx::Value var[3];
            var[0].SetBoolean(true);
            var[1].SetBoolean(true);
            var[2].SetString(cmHelpme);
            gfxHUD.Invoke("_root.api.showChat", var, 3);
            chatVisibleUntilTime = r3dGetTime() + 20.0f;
        }
    increment, change, and set!

    Let me know if this helps you out or not :)
    Last edited by SanGawku; 02-07-13 at 10:57 AM. Reason: Sorry wrong source file :D


  2. #2
    Yuri-BR#1559 Yuri-BR is offline
    DeveloperRank
    Apr 2013 Join Date
    ☣️❤️Location
    1,039Posts

    Re: Context Menu Additions

    Good Job ;)

  3. #3
    Sorcerer Supreme Dragonbooss is offline
    Member +Rank
    May 2013 Join Date
    BrazilLocation
    267Posts

    Re: Context Menu Additions

    I'm testing, thanks for share!

  4. #4
    Sorcerer Supreme Poster13 is offline
    Member +Rank
    Jun 2013 Join Date
    395Posts

    Re: Context Menu Additions

    Thanks man! Thanks!

  5. #5
    Connoisseur of Fine Code SanGawku is offline
    ModeratorRank
    Oct 2006 Join Date
    CyberSpanksLocation
    645Posts

    Re: Context Menu Additions

    If you like it, like my post :)

  6. #6
    Sorcerer Supreme Poster13 is offline
    Member +Rank
    Jun 2013 Join Date
    395Posts

    Re: Context Menu Additions

    error.png
    whats error????

  7. #7
    Elite Member Lewis Caddick is offline
    Member +Rank
    May 2013 Join Date
    Casa Del LewisLocation
    160Posts

    Re: Context Menu Additions

    i tried this in the other topic, it shows the buttons but doesn't actually work.

  8. #8
    Connoisseur of Fine Code SanGawku is offline
    ModeratorRank
    Oct 2006 Join Date
    CyberSpanksLocation
    645Posts

    Re: Context Menu Additions

    @Lewis, They do work, You have to have the functions like /goto or /ban etc.
    @Poster13; To fix the error add int to the isDev declaration. Edited first post to reflect the change.

    Sorry guys

  9. #9
    Elite Member Lewis Caddick is offline
    Member +Rank
    May 2013 Join Date
    Casa Del LewisLocation
    160Posts

    Re: Context Menu Additions

    Quote Originally Posted by kalisto2002 View Post
    @Lewis, They do work, You have to have the functions like /goto or /ban etc.
    @Poster13; To fix the error add int to the isDev declaration. Edited first post to reflect the change.

    Sorry guys
    i do have the command /kick and /ban, can you skype me and give me a hand.

  10. #10
    Sorcerer Supreme Hypoflex is offline
    Member +Rank
    May 2012 Join Date
    NetherlandsLocation
    256Posts

    Re: Context Menu Additions

    it works perfect for me but only shows in studio, any way to change this?

  11. #11
    Elite Member Duong Phan is offline
    Member +Rank
    Sep 2012 Join Date
    VNLocation
    203Posts

    Re: Context Menu Additions

    You can only add 4 command in list, the report command can't replace or i don't know where to replace it :D, work good on both WarZ.exe and studio

  12. #12
    Sorcerer Supreme Poster13 is offline
    Member +Rank
    Jun 2013 Join Date
    395Posts

    Re: Context Menu Additions

    Whats command "HELP ME" please more,,,???

  13. #13
    Connoisseur of Fine Code SanGawku is offline
    ModeratorRank
    Oct 2006 Join Date
    CyberSpanksLocation
    645Posts

    Re: Context Menu Additions

    help me is supposed to post to world chat, the persons X and Y but localpos isnt what i was looking for as soon as i find it i will update ;)



Advertisement