给作弊器加播放器代码

社区服务
高级搜索
猴岛论坛CSGO反恐精英CS作弊器交流讨论给作弊器加播放器代码
发帖 回复
倒序阅读 最近浏览的帖子最近浏览的版块
1个回复

给作弊器加播放器代码

楼层直达
莎仕芘亞

ZxID:1171401

等级: 元老
猴岛国防部部长

举报 只看楼主 使用道具 楼主   发表于: 2007-06-27 0
How To Add Winamp To Your Hack!
Credits:DAG and OGC Team
Note: I did not make this code i'm just posting it so you can add it as GeneraL said.
add this correctly and you should get 0 errors

First off you need to make a winamp.cpp and .h

paste this in your winamp.cpp
Code:
#include <windows.h>
#include "Winamp.h"
#include "cvar.h"
#include "client.h"
#include "console.h"
#include "interpreter.h"
#include <assert.h>
#define WA_GETTRACKLENGTH 105
#define maxbars 20
char bars[maxbars+5];
//================================================================================
Winamp winamp;
//================================================================================
Winamp::Winamp(void)
{
  hwnd=0;
  crossfade=1.0f;
  paused=0;
  playing=1;
}

//================================================================================
void Winamp::setfracvol(void)
{
  float f = crossfade;
  f = f*f;

  int wvol = cvar.wa_vol1 + (DWORD)(f*(cvar.wa_vol2-cvar.wa_vol1));
 
  assert(hwnd);
  PostMessage(hwnd,WM_USER,wvol,122); // setvolume

  float hlvol = cvar.hl_vol1 + (cvar.hl_vol2-cvar.hl_vol1)*(1.0f-f);
  char buf[64]; sprintf(buf,"volume %f",hlvol);
  gEngfuncs.pfnClientCmd(buf);
}

//================================================================================
void Winamp::fadein(void)
{
  if(crossfade==1.0 || !playing) return;
  if(paused) command("pause");//unpause

  crossfade += cvar.wa_fadeinspeed;
  if(crossfade>1.0f) crossfade = 1.0f;

  setfracvol();
}

//================================================================================
void Winamp::fadeout(void)
{
  if(crossfade==0.0f)
  {
    if(!paused)
    {
      if(!cvar.wa_vol1)
      {
        command("pause");// pause
        command("back" );
      }
    }
    return;
  }

  crossfade -= cvar.wa_fadeoutspeed;
  if(crossfade<0) crossfade = 0;


  setfracvol();
}

//================================================================================
void Winamp::frame(void)
{
  if(searchForWindowEventCounter.get()) { searchWindow(); }

  if(hwnd)
  {
    int n = fadeEventCounter.get();
    if(cvar.wa_autovolume)
    {
      for(int i=0;i<n;i++)
      {
        if(cvar.alive_method==1)
        {
          fadein();
        }
        else
        {
          fadeout();
        }
      }
    }

    if(titleUpdateEventCounter.get()&&playing) { updateTitle(); }
  }
  else
  {
    title.erase();
  }
}

//================================================================================
void Winamp::searchWindow()
{
  HWND old = hwnd;
  hwnd = FindWindow("Winamp v1.x",NULL);
 
  if(old!=hwnd)
  {
    if(hwnd)
    {
      if(!old) { gConsole.echo("-]| Winamp Controls Found |[-"); }
      else   { gConsole.echo("-]| Found Another Winamp Instance |[-");   }
    }
    else   { gConsole.echo("WinAmp window lost."         ); }
  }
}

//================================================================================
void Winamp::updateTitle()
{
  assert(hwnd);
  char this_title[2048],*p;
  int success = GetWindowText(hwnd,this_title,sizeof(this_title));

  if(!success) { title.erase(); return; }
  p = this_title+strlen(this_title);//-8;
  while (p >= this_title)
  {
    if (!strnicmp(p,"- Winamp",8)) break;
    p--;
  }
  if (p >= this_title) p--;
  while (p>=this_title && *p==' ') p--;
  *++p=0;

  char* pos = this_title;
  while(*pos){ if(*pos<' '||*pos>127){ *pos='-';} ++pos;}

  if(title!=this_title && winamp.title.size()) // did the title change?
  {
    char say[1200];
    char* formatA = "#say -|[: Winamp :][: Listening To: %s :]|-"; // has hours say to HL

    sprintf(say,formatA,this_title);

    if (cvar.wa_saytitle)
    {
      cmd.exec(say); // send to HL
    }
  }
  title = this_title;
}

//================================================================================
void Winamp::command(const string& subcommand, const string& arg1, const string& arg2, const string& arg3)
{
  // hwnd independent:
  if(0) {}
  else if (subcommand=="1") { cvar.wa_active=1; }
  else if (subcommand=="0") { cvar.wa_active=0; }
 
  if(!cvar.wa_active)     { gConsole.echo("type \"winamp 1\" first!"); return; }
  if(!hwnd)           { gConsole.echo("-]| Winamp Needs To Be Running! |[-"); return; }

  // hwnd dependent:
  #define CHECK_COMMAND(name,number) } else if(subcommand==name) { PostMessage(hwnd,WM_COMMAND,number,0);
  if(0){
  CHECK_COMMAND("play"   ,40045) paused=false; playing=true;
  CHECK_COMMAND("pause" ,40046) if(playing) paused=!paused;
  CHECK_COMMAND("stop"   ,40047) paused=false; playing=false;title.erase();
  CHECK_COMMAND("forward",40148)
  CHECK_COMMAND("back"   ,40144)
  CHECK_COMMAND("next"   ,40048)
  CHECK_COMMAND("prev"   ,40044)
  CHECK_COMMAND("close" ,40001)
  }

  long trackpos = PostMessage(hwnd, WM_USER, 0, WA_GETTRACKLENGTH);
  long tracklen = PostMessage(hwnd, WM_USER, 1, WA_GETTRACKLENGTH);

  if(tracklen){
    memset(bars,'=',maxbars+6);
    bars[0] = '[';
    bars[maxbars+1] = ']';
    memset(bars+maxbars+2,0,3);
    for(int i = 1; i <= (((trackpos/1000.0f)/tracklen)*maxbars); i++)
      bars
= '+';
  }else{
    memset(bars,'x',maxbars+6);
    bars[0] = '[';
    bars[maxbars+1] = ']';
    memset(bars+maxbars+2,0,3);
  }
 

  if(0) {}
  else if(subcommand=="repeat" ) { PostMessage(hwnd,WM_USER,atoi(arg1.c_str()),253); }
  else if(subcommand=="shuffle") { PostMessage(hwnd,WM_USER,atoi(arg1.c_str()),252); }
  else if(subcommand=="volume" ) { PostMessage(hwnd,WM_USER,atoi(arg1.c_str()),122); }

}

and add this to winamp.h

Code:
#pragma once
#include <string>
using namespace std;
#include "timehandling.h"

//================================================================================
class Winamp
{
public:
  void updateTitle();
  void play ();
  void frame();
  bool playing;
  void command(const string& subcommand, const string& arg1="", const string& arg2="", const string& arg3="");
  string title;

protected:
  HWND   hwnd;

  // volume stuff
  float crossfade; // 0..1
  void searchWindow();
  void fadein();
  void fadeout();
  void setfracvol();
  void pause();
  bool paused;

  EventCounter<0.1> fadeEventCounter;         // fade one tick up/down every 0.1 seconds
  EventCounter<10> searchForWindowEventCounter; // search for winamp window every 10 seconds
  EventCounter<2>   titleUpdateEventCounter;     // update title every 2 seconds

public:
  Winamp();
};


extern Winamp winamp;


now in your client.cpp
add this to ur includes


Code:
#include "winamp.h"
find your hudDrawInfoTexts and add this to any part of it.



Code:
if (cvar.wa_title && winamp.title.size())
  {  
    int wa_y = displayCenterY*2-180-54;
    ColorEntry* clr=colorList.get(8);
    DrawHudString(5,wa_y,0,0,255, winamp.title.c_str() );
  }
next in int HUD_Redraw

under
hudDrawInfoTexts();



Code:
if (cvar.wa_active)   { winamp.frame     (); }

add this any where in client


//===================================================================================
void func_wa_say()
{
  char tmp[128];
  sprintf(tmp,"say -|[: Winamp :][: Listening To: %s :]|-",winamp.title.c_str());
  gEngfuncs.pfnClientCmd(tmp);
}
//===================================================================================
void func_play(){ sndPlaySound(getOgcDirFile(cmd.argC(1)).c_str(), SND_ASYNC); }

//========================================================================================
void func_turn()
{
  double degrees = cmd.argF(1);
  mainViewAngles[1] += degrees;
  if( mainViewAngles[1]>360.0 ) mainViewAngles[1] -= 360.0;
  gEngfuncs.SetViewAngles(mainViewAngles);

}
void func_winamp() { winamp.command(cmd.argS(1),cmd.argS(2),cmd.argS(3),cmd.argS(4)); }

void func_user() { gConsole.echo("User: DAG"); }
//===================================================================================
void func_entinfo()
{
  int index = cmd.argI(1);
  Con_Echo("info:" );
  Con_Echo("name=%s pvs=%d alive=%d team=%d", vPlayers[index].entinfo.name, vPlayers[index].getPVS(), vPlayers[index].getAlive(),vPlayers[index].team);
  Con_Echo("solid: %d me: alive=%d team=%d",vPlayers[index].getEnt()->curstate.solid,me.alive,me.team);  
}
//===================================================================================
next under Init_Command_Interpreter

Add commands


Code:
REGISTER_COMMAND(user     )
REGISTER_COMMAND(winamp )
REGISTER_COMMAND(play     )
REGISTER_COMMAND(turn     )
REGISTER_COMMAND(wa_say )
in your cvar.cpp add


Code:
REGISTER_CVAR_FLOAT( hl_vol1   ,0.2)
REGISTER_CVAR_FLOAT( hl_vol2   ,0.7)
REGISTER_CVAR_FLOAT( wa_fadeinspeed   ,0.0)
REGISTER_CVAR_FLOAT( wa_fadeoutspeed ,0.0)
REGISTER_CVAR_FLOAT( wa_vol1 ,0.0)
REGISTER_CVAR_FLOAT( wa_vol2 ,1.0)
REGISTER_CVAR_INT( wa_active ,1)
REGISTER_CVAR_INT( wa_title ,1)
REGISTER_CVAR_INT( wa_saytitle ,0)
REGISTER_CVAR_INT( wa_autovolume ,0)
now in your cvar.h add



Code:
float hl_vol1;
float hl_vol2;
float wa_fadeinspeed;
float wa_fadeoutspeed;
float wa_vol1;
float wa_vol2;
int wa_active;
int wa_title;
int wa_saytitle;
int wa_autovolume;
Now Finally
add this to your menu
" " " Winamp " {
" " "> Play" "winamp play"
" " "[] Stop" "winamp stop"
" " "|| Pause" "winamp pause"
" " ">> Fast Forward" "winamp forward"
" " "<< Rewind" "winamp back"
" " "|> Next" "winamp next"
" " "<| Previous" "winamp prev"
" " "|X| Close" "winamp close"
" " "Draw Title" "wa_title change"
" " "Say Title Now" "wa_say"
" " "Say Title On Next" "wa_saytitle 1"
" " "Volume" {
" " "Volume: Automatic" "wa_autovolume 1;"
" " "Volume: ********" "wa_autovolume 0;winamp volume 255;"
" " "Volume: *******" "wa_autovolume 0;winamp volume 224;"
" " "Volume: ******" "wa_autovolume 0;winamp volume 192;"
" " "Volume: *****" "wa_autovolume 0;winamp volume 160;"
" " "Volume: ****" "wa_autovolume 0;winamp volume 128;"
" " "Volume: ***" "wa_autovolume 0;winamp volume 96;"
" " "Volume: **" "wa_autovolume 0;winamp volume 64;"
" " "Volume: *" "wa_autovolume 0;winamp volume 32;"
}


變形殺手

ZxID:1271049

等级: 新兵
举报 只看该作者 沙发   发表于: 2007-09-30 0
 
« 返回列表
发帖 回复