Context Menu Additions

Status
Not open for further replies.
Moderator
Staff member
Moderator
Joined
Oct 8, 2006
Messages
668
Reaction score
393
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:
error - Context Menu Additions - RaGEZONE Forums
whats error????
 
@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
 
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
 
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 ;)
 
Status
Not open for further replies.
Back