THREAD: Dvars Cvars Commands etc. in SPRX
  1. 05-25-2019, 06:12 PM
    AlexZero's Avatar
    AlexZero
    Rookie
    AlexZero's Avatar
    AlexZero
    Rookie
    1
    Posts
    10
    Reputation
    Jul 2017
    NextGenUpdate
    Hello all
    how i can add dvars options in my sprx mod menu ? i want add some options (third person,fov, etc )
    but i new about and i dont know
    please help
  2. 08-07-2019, 07:02 PM
    226
    Posts
    1,969
    Reputation
    Sep 2010
    NextGenUpdate
    Originally Posted by AlexZero View Post
    Hello all
    how i can add dvars options in my sprx mod menu ? i want add some options (third person,fov, etc )
    but i new about and i dont know
    please help


    Here ya go: https://pastebin.com/u/MrDarkblue


    bool Redboxes_t;
    bool NoFog_t;
    bool ShowCompass_t;
    bool AUAV_t;
    bool Laser_t;
    bool Drawgun_t;
    bool SuperSteadyAim_t;
    bool SuperQuickDraw_t;
    bool SuperSleightofHand_t;
    bool InGamePlayerColor_t;
    bool NoRecoil_t;
    bool LeetVision_t;
    bool drawCrosshair_t;
    bool ThirdPerson_t;
    bool GlassGravity_t;
    bool FloatingBodies_t;
    bool drawFPS_t;
    bool ui_text_t;
    bool ShowPing_t;
    bool Blur_t;
    bool ChangeKillFeedColor_t;
    bool ChromePlayers_t;
    bool RapidFire_t;
    bool ColouredBox_t;
    bool DrawgunLeft_t;

    opd_s Com_sprintf_s = { Com_sprintf_t, TOC };
    int(*Com_sprintf)(char *dest, int size, const char *fmt, ...) = (int(*)(char *, int, char const *, ...))&Com_sprintf_s;
    opd_s Cbuff_AddText_s = { Cbuff_AddText_t, TOC };
    void(*Cbuff_AddText)(int localClientNum, const char * text) = (void(*)(int, const char *))&Cbuff_AddText_s;
    opd_s SV_GameSendServerCommand_s = { SV_GameSendServerCommand_t, TOC };
    void(*SV_GameSendServerCommand)(int client, int type, char* cmd) = (void(*)(int, int, char*))&SV_GameSendServerCommand_s;
    int CG_VisionSetStartLerp_To_t[2] = { 0xB078C, TOC };
    void(*CG_VisionSetStartLerp_To)(int unk, int unk1, int unk2, const char *name, int duration) = (void(*)(int, int, int, const char*, int))&CG_VisionSetStartLerp_To_t;
    opd_s CG_PlayRumble_t = { 0x909D0, TOC };
    int(*CG_PlayRumble)(int Localclient, const char* rumble) = (int(*)(int, const char*))&CG_PlayRumble_t;

    /////////////////////////////////////
    ///Non-Host iPrintln & iPrintlnBold
    /////////////////////////////////////
    opd_s CG_GameMessage_s = { CG_GameMessage_t, TOC };
    void(*CG_GameMessage)(int localClientNum, const char* msg) = (void(*)(int, const char*))&CG_GameMessage_s;

    void iPrintln(const char * text) {
    iPrintlnText = text;
    iPrintlner = true;}

    opd_s CG_GameMessageBold_s = { CG_GameMessageBold_t, TOC };
    void(*CG_GameMessageBold)(int localClientNum, const char* msg) = (void(*)(int, const char*))&CG_GameMessageBold_s;

    void iPrintlnBold(const char * text) {
    iPrintlnBoldText = text;
    iPrintlnBolder = true;}}

    //////////////////////
    ///Non-Host Play Sound
    //////////////////////
    opd_s UI_PlaySound_s = { UI_PlaySound_t, TOC };
    void(*UI_PlaySound)(int context, const char* soundalias) = (void(*)(int, const char*))&UI_PlaySound_s;

    //////////////////////
    ///Button Monitoring
    //////////////////////
    opd_s Key_IsDown_s = { Key_IsDown_t, TOC };
    int(*Key_IsDown)(int localClientNum, int keynum) = (int(*)(int, int))&Key_IsDown_s;

    enum Buttons{
    Null = 0,
    X = 1,
    O = 2,
    square = 3,
    triangle = 4,
    L1 = 5,
    R1 = 6,
    start = 14,
    select = 15,
    L3 = 16,
    R3 = 17,
    L2 = 18,
    R2 = 19,
    UP = 20,
    DOWN = 21,
    LEFT = 22,
    RIGHT = 23,
    APAD_UP = 28,
    APAD_DOWN = 29,
    APAD_LEFT = 30,
    APAD_RIGHT = 31
    };

    ///////////////////////////////
    ///Basic ReadBool Functions
    ///////////////////////////////
    bool inGame() {
    if (*(char*)cl_InGame == 1)
    return true;
    else
    return false;}
    bool IsHost() {
    if (PSNName() == HostName()) //not accurate when using changename function
    return true;
    else
    return false;}

    ///////////////////////////////
    ///Basic ReadString Functions
    ///////////////////////////////
    const char* MapName() { return Dvar_GetString("ui_mapname");}
    const char* GameMode() { return Dvar_GetString("ui_gametype");}
    const char* HostName() { return Dvar_GetString("sv_hostname");}

    char* PSNName() { return ReadString(0x01BBBC2C); }
    char* Country() { return ReadString(0x01cf1a87); }
    char* State() { return ReadString(0x01cf1acCool Man (aka Tustin); }
    char* City() { return ReadString(0x01cf1b09); }
    char* IP() { return ReadString(0x01BBFE3C); } // changes to last player ip that entered lobby

    //////////////////////
    ///Basic Functions
    //////////////////////
    void Redboxes(){
    Redboxes_t = !Redboxes_t;
    char bytesOn[] = { 0x60, 0x00, 0x00, 0x00 };
    char bytesOff[] = { 0x41, 0x82, 0x00, 0x0C };
    write_process(0x65D14, Redboxes_t ? bytesOn : bytesOff, sizeof(Redboxes_t ? bytesOn : bytesOff));
    iPrintln(va("Redboxes: %s", Redboxes_t ? "^2On" : "^1Off"));
    }
    void NoFog(){
    NoFog_t = !NoFog_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x00 };
    write_process(0x18C9158, NoFog_t ? bytesOn : bytesOff, sizeof(NoFog_t ? bytesOn : bytesOff));
    iPrintln(va("No Fog: %s", NoFog_t ? "^2On" : "^1Off"));
    }
    void ShowCompass(){
    ShowCompass_t = !ShowCompass_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x00 };
    write_process(0x18caaa0, ShowCompass_t ? bytesOn : bytesOff, sizeof(ShowCompass_t ? bytesOn : bytesOff));
    iPrintln(va("Show Compass: %s", ShowCompass_t ? "^2On" : "^1Off"));
    }
    void AUAV(){
    AUAV_t = !AUAV_t;
    char bytesOn[] = { 0x02 };
    char bytesOff[] = { 0x01 };
    write_process(0x5F067, AUAV_t ? bytesOn : bytesOff, sizeof(AUAV_t ? bytesOn : bytesOff));
    iPrintln(va("Advanced UAV: %s", AUAV_t ? "^2On" : "^1Off"));
    }
    void Laser(){
    Laser_t = !Laser_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x00 };
    write_process(0xB6703, Laser_t ? bytesOn : bytesOff, sizeof(Laser_t ? bytesOn : bytesOff));
    iPrintln(va("Laser: %s", Laser_t ? "^2On" : "^1Off"));
    }
    void Drawgun(){
    Drawgun_t = !Drawgun_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x00 };
    write_process(0x18d5308, Drawgun_t ? bytesOn : bytesOff, sizeof(Drawgun_t ? bytesOn : bytesOff));
    iPrintln(va("Drawgun: %s", Drawgun_t ? "^2On" : "^1Off"));
    }
    void SuperSteadyAim(){
    SuperSteadyAim_t = !SuperSteadyAim_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x3F };
    write_process(0x18de168, SuperSteadyAim_t ? bytesOn : bytesOff, sizeof(SuperSteadyAim_t ? bytesOn : bytesOff));
    iPrintln(va("SuperSteadyAim: %s", SuperSteadyAim_t ? "^2On" : "^1Off"));
    }
    void SuperQuickDraw(){
    SuperQuickDraw_t = !SuperQuickDraw_t;
    char bytesOn[] = { 0x45 };
    char bytesOff[] = { 0x3F };
    write_process(0x18de784, SuperQuickDraw_t ? bytesOn : bytesOff, sizeof(SuperQuickDraw_t ? bytesOn : bytesOff));
    iPrintln(va("SuperQuickDraw: %s", SuperQuickDraw_t ? "^2On" : "^1Off"));
    }
    void SuperSleightofHand(){
    SuperSleightofHand_t = !SuperSleightofHand_t;
    char bytesOn[] = { 0x01 };
    char bytesOff[] = { 0x3F };
    write_process(0x18de1ac, SuperSleightofHand_t ? bytesOn : bytesOff, sizeof(SuperSleightofHand_t ? bytesOn : bytesOff));
    iPrintln(va("SuperSleightofHand: %s", SuperSleightofHand_t ? "^2On" : "^1Off"));
    }
    void InGamePlayerColor(){
    InGamePlayerColor_t = !InGamePlayerColor_t;
    char bytesOn[] = { 0xFF, 0xFF };
    char bytesOff[] = { 0x00, 0x00 };
    write_process(0x18D75D6, InGamePlayerColor_t ? bytesOn : bytesOff, sizeof(InGamePlayerColor_t ? bytesOn : bytesOff));
    iPrintln(va("InGamePlayerColor: %s", InGamePlayerColor_t ? "^2On" : "^1Off"));
    }
    void NoRecoil(){
    NoRecoil_t = !NoRecoil_t;
    char bytesOn[] = { 0x60, 0x00, 0x00, 0x00 };
    char bytesOff[] = { 0x4B, 0xF8, 0x15, 0x01 };
    write_process(0xBE6D0, NoRecoil_t ? bytesOn : bytesOff, sizeof(NoRecoil_t ? bytesOn : bytesOff));
    iPrintln(va("NoRecoil: %s", NoRecoil_t ? "^2On" : "^1Off"));
    }
    void LeetVision(){
    LeetVision_t = !LeetVision_t;
    Cbuff_AddText(0, LeetVision_t ? "ui_debugMode 1" : "ui_debugMode 0");
    iPrintln(va("LeetVision: %s", LeetVision_t ? "^2On" : "^1Off"));
    }
    void drawCrosshair(){
    drawCrosshair_t = !drawCrosshair_t;
    Cbuff_AddText(0, drawCrosshair_t ? "ui_drawCrosshair 1" : "ui_drawCrosshair 0");
    iPrintln(va("drawCrosshair: %s", drawCrosshair_t ? "^2On" : "^1Off"));
    }
    void ThirdPerson(){
    ThirdPerson_t = !ThirdPerson_t;
    Cbuff_AddText(0, ThirdPerson_t ? "g_thirdPerson 1" : "g_thirdPerson 0");
    iPrintln(va("thirdPerson: %s", ThirdPerson_t ? "^2On" : "^1Off"));
    }
    void GlassGravity(){
    GlassGravity_t = !GlassGravity_t;
    Cbuff_AddText(0, GlassGravity_t ? "glass_fall_gravity -99" : "glass_fall_gravity 800"); // 65
    iPrintln(va("glass_fall_gravity: %s", GlassGravity_t ? "^2On" : "^1Off"));
    }
    void DrawgunLeft(){
    DrawgunLeft_t = !DrawgunLeft_t;
    Cbuff_AddText(0, DrawgunLeft_t ? "cg_gun_y 10; cg_gun_x 1" : "cg_gun_y 0; cg_gun_x 0");
    iPrintln(va("DrawgunLeft: %s", DrawgunLeft_t ? "^2On" : "^1Off"));
    }
    void FloatingBodies(){
    FloatingBodies_t = !FloatingBodies_t;
    Cbuff_AddText(0, FloatingBodies_t ? "phys_gravity_ragdoll 99" : "phys_gravity_ragdoll -800");
    iPrintln(va("gravity_ragdoll: %s", FloatingBodies_t ? "^2On" : "^1Off"));
    }
    void drawFPS(){
    drawFPS_t = !drawFPS_t;
    Cbuff_AddText(0, drawFPS_t ? "cg_drawFPS 1 " : "cg_drawFPS 0"); //cg_drawFPSLabels 2 1
    iPrintln(va("drawFPS: %s", drawFPS_t ? "^2On" : "^1Off"));
    }
    void ColouredBox(){
    ColouredBox_t = !ColouredBox_t;
    Cbuff_AddText(0, ColouredBox_t ? "r_showFBColorDebug 1" : "r_showFBColorDebug 0");
    iPrintln(va("ColouredBox: %s", ColouredBox_t ? "^2On" : "^1Off"));
    }
    // ui_debug_localVarBool
    void ui_text(){
    ui_text_t = !ui_text_t;
    Cbuff_AddText(0, ui_text_t ? "ui_debug_localVarBool YO WAZAP" : "ui_debug_localVarBool YO WAZAP");
    iPrintln(va("ui_text: %s", ui_text_t ? "^2On" : "^1Off"));
    }
    void ShowPing(){
    ShowPing_t = !ShowPing_t;
    Cbuff_AddText(0, ShowPing_t ? "cl_maxPing 1" : "cl_maxPing 0");
    iPrintln(va("ShowPing: %s", ShowPing_t ? "^2On" : "^1Off"));
    }
    void Blur(){
    Blur_t = !Blur_t;
    Cbuff_AddText(0, Blur_t ? "r_blur 5" : "reset r_blur");
    iPrintln(va("Blur: %s", Blur_t ? "^2On" : "^1Off"));
    }
    void ChangeKillFeedColor(char* ColorAllies = "1 0 0 1", char* ColorAxis = "0 0 1 1"){
    ChangeKillFeedColor_t = !ChangeKillFeedColor_t;
    Cbuff_AddText(0, ChangeKillFeedColor_t ? va("cg_TeamColor_Allies %s ; cg_TeamColor_Axis %s", ColorAllies, ColorAxis) : "cg_TeamColor_Allies 0.15 0.16 0.18 0.26; cg_TeamColor_Axis 0.17 0.15 0.11 0.26");
    iPrintln(va("ChangeKillFeedColor: %s", ChangeKillFeedColor_t ? "^2On" : "^1Off"));
    }
    void ChromePlayers(){
    ChromePlayers_t = !ChromePlayers_t;
    char bytesOn[] = { 0x01 };
    char bytesOn2[] = { 0x05, 0x70 };
    char bytesOff[] = { 0x00 };
    char bytesOff2[] = { 0x05, 0x6A };
    write_process(0x3984DF, ChromePlayers ? bytesOn : bytesOff, sizeof(ChromePlayers_t ? bytesOn : bytesOff));
    write_process(0x3984F2, ChromePlayers ? bytesOn2 : bytesOff2, sizeof(ChromePlayers_t ? bytesOn2 : bytesOff2));
    iPrintln(va("ChromePlayers: %s", ChromePlayers_t ? "^2On" : "^1Off"));
    }
    void RapidFire(){
    RapidFire_t = !RapidFire_t;
    char bytesOn1[] = { 0x60, 0x00, 0x00, 0x00 };
    char bytesOn2[] = { 0xC0, 0x23, 0x00, 0x00 };
    char bytesOn3[] = { 0x48, 0x00, 0x00, 0x3C };
    char bytesOn4[] = { 0x3D, 0x4C, 0xCC, 0xCD };

    char bytesOff1[] = { 0x41, 0x82, 0x00, 0x94 };
    char bytesOff2[] = { 0xC0, 0x24, 0x00, 0x00 };
    char bytesOff3[] = { 0x40, 0x82, 0x00, 0x3C };
    char bytesOff4[] = { 0x41, 0x82, 0x00, 0x94 };

    write_process(0x31D6C, RapidFire ? bytesOn1 : bytesOff1, sizeof(RapidFire_t ? bytesOn1 : bytesOff1));
    write_process(0x31D84, RapidFire ? bytesOn2 : bytesOff2, sizeof(RapidFire_t ? bytesOn2 : bytesOff2));
    write_process(0x31D8C, RapidFire ? bytesOn3 : bytesOff3, sizeof(RapidFire_t ? bytesOn3 : bytesOff3));
    write_process(0x31B44, RapidFire ? bytesOn4 : bytesOff4, sizeof(RapidFire_t ? bytesOn4 : bytesOff4));
    iPrintln(va("RapidFire: %s", RapidFire_t ? "^2On" : "^1Off"));
    }
    //////////////////////
    ///Basic+ Functions
    //////////////////////
    char* KeyBoard(char* Title)
    {
    opd_s key = { 0x026F5BC, TOC };
    void(*Run)(int, char*, char*, int, int, int) = (void(*)(int, char*, char*, int, int, int))&key;
    Run(0, Title, "", 20, 0x72DCE8, 0x7239A0);
    while (PS3::ReadInt32(0x73145C) != 0) //ReadInt32 5F
    {
    continue;
    }
    return PS3::ReadString(0x2380E22);
    }
    void Cbufkeyboard(int client)
    {
    Cbuff_AddText(client, KeyBoard("Cbuff_AddText - Change Dvars. Example:ui_debug 1"));
    }
    //////////////////////////
    /////// Non-Host Vision
    //////////////////////////
    void ChangeVision(char* Vision){
    CG_VisionSetStartLerp_To((*(int*)(0x7BD00Cool Man (aka Tustin) + 0x1044ACool Man (aka Tustin), 0, 3, Vision, 0);
    }

    /////// Non-Host Name Changer "Needs to be in a thread or Hook"
    void ChangeInGameName(char* Name){
    Cbuff_AddText(0, va(";userinfo \"\\name\\%s\";" , Name));
    }
    void ChangeInGameNameClantag(char* ClanTag, char* Name){
    Cbuff_AddText(0, va(";userinfo \"\\clanAbbrev\\%s\\name\\%s\";", ClanTag, Name);
    }
    /////////////////////////////////////////////////////////////////////////////////////////
    void ChangeTeamAllies(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " allies;");
    Cbuff_AddText(0, allies);
    }
    void ChangeTeamAxis(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " axis;");
    Cbuff_AddText(0, allies);
    }
    void NonHostSpectator(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " spectator;");
    Cbuff_AddText(0, allies);
    }
    void SelectClass()
    {
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " changeclass_opfor;");
    Cbuff_AddText(0, allies);
    }
    void ChangeClass(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " custom1;");
    Cbuff_AddText(0, allies);
    }
    void EndMatch(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " -1 endround;");
    Cbuff_AddText(0, allies);
    }
    void Juggernaut(){
    char allies[0x100];
    Sprintf(allies, "cmd mr %i %i %s", *(int*)(0x00832524), 3, " 10 juggernaut;");
    Cbuff_AddText(0, allies);
    }
    Last edited by mrdarkblue ; 08-07-2019 at 07:08 PM.

  3. The Following User Thanked mrdarkblue For This Useful Post: