mad boy (02-02-2011),PikaMucha_Itu (02-10-2011),Sixx93 (02-02-2011)
Idk what this can be used for but i guess you can use it for "Speed Surprise".Code:int RandomNum(int lowest, int highest) { int random_integer; int range=(highest-lowest)+1; random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0)); return random_integer; }
A feature I'm adding into my menu hack /
You never know how fast you will go in ca
How to use
Code:Lucky = RandomNum(1,100000);
Credits:
Me for function
No I do not make game hacks anymore, please stop asking.
mad boy (02-02-2011),PikaMucha_Itu (02-10-2011),Sixx93 (02-02-2011)
Code:int GetRandomNumber(int MAXNUM) { srand((DWORD)time(0)); return rand() % MAXNUM; }
Last edited by kotentopf; 02-02-2011 at 04:04 AM.
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
kotentopf (02-02-2011)
i know....
The Internet SHOULD Be Illegal
When you say
"Java is a great programming language because it works on all platforms"
it is just like
"anal sex is great because it works on all genders"
Are YOU a Troll?
damn, ty i was searching for something about how to get a random number... i know the rand() function (not so good), but i have some problems... ty for this!
List Of My Public Releases
Wallhack and NoFog - Detected (https://www.mpgh.net/forum/164-combat...ml#post1391299)
BOSCHACK CA EU v1.0 - Detected (https://www.mpgh.net/forum/172-combat...eu-v1-0-a.html)
BOSCHACK CA EU v1.1 - Detected (https://www.mpgh.net/forum/172-combat...ml#post2371767)
BOSCHACK Returned - Detected (https://www.mpgh.net/forum/172-combat...eturn-pub.html)
Make Hacks In 5min in 3 Steps
I found similar post by Raygoe in 2007, honestly you didnt create the function.
[Highlight=C++]#include "input.h"
#include "OgreStringConverter.h"
#include "simulation.h"
#include "Ogre.h"
#include <string>
#include <sstream>
#include <iostream>
#include <ctime>
#include <cstdlib>
#include "OgreWindowEventUtilities.h"
int randomNum (int lowest, int highest) {
int random_integer;
int range = (highest-lowest)+1;
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
return random_integer;
}
InputHandler::InputHandler(Simulation *sim, unsigned long hWnd, Ogre::Root* ogre, Ogre::RenderWindow* window, Ogre::SceneManager* sceneMgr, Ogre::Camera* camera, Ogre::SceneNode* buildnode, Ogre::SceneNode* cameraNode) {
root_ogre = ogre;
rWindow = window;
sMan = sceneMgr;
cam = camera;
bNode = buildnode;
robotI = 0;
OIS::ParamList pl;
pl.insert(OIS::ParamList::value_type("WINDOW", Ogre::StringConverter::toString(hWnd)));
//SHOW MOUSE
pl.insert(std::make_pair(std::string("w32_mouse"), std::string("DISCL_FOREGROUND")));
pl.insert( std::make_pair( std::string( "w32_mouse" ), std::string("DISCL_NONEXCLUSIVE") ) );
m_hWnd = hWnd;
m_ois = OIS::InputManager::createInputSystem( pl );
mMouse = static_cast<OIS::Mouse*>(m_ois->createInputObject( OIS::OISMouse, true ));
mKeyboard = static_cast<OIS::Keyboard*>(m_ois->createInputObject( OIS::OISKeyboard, true));
mMouse->setEventCallback(this);
mKeyboard->setEventCallback(this);
mRotate = 0.13;
mMove = 0;
mContinue = true;
m_simulation = sim;
mDirection = cam->getPosition();
camNode = cameraNode;
srand((unsigned)time(0));
targetNode = sMan->getSceneNode("playerRob");
}
InputHandler::~InputHandler() {
if (mMouse)
delete mMouse;
if (mKeyboard)
delete mKeyboard;
OIS::InputManager::destroyInputSystem(m_ois);
}
void InputHandler::capture() {
mMouse->capture();
mKeyboard->capture();
}
bool InputHandler::movePlayerCam(float ft) {
frameTime = (ft);
if (mKeyboard->isKeyDown(OIS::KC_UP) || mKeyboard->isKeyDown(OIS::KC_W) || mKeyboard->isKeyDown(OIS::KC_DOWN) || mKeyboard->isKeyDown(OIS::KC_S)) {
mDirection = (0,0,mMove);
didMove = true;
}
if (mKeyboard->isKeyDown(OIS::KC_LEFT) || mKeyboard->isKeyDown(OIS::KC_A)) {
targetNode->yaw(Ogre:egree(2*frameTime),Ogre::Node::TS_WORLD);
camNode->yaw(Ogre:egree(2*frameTime),Ogre::Node::TS_WORLD);
didMove = true;
}
else if (mKeyboard->isKeyDown(OIS::KC_RIGHT) || mKeyboard->isKeyDown(OIS::KC_D)) {
targetNode->yaw(Ogre:egree(-2*frameTime),Ogre::Node::TS_WORLD);
camNode->yaw(Ogre:egree(-2*frameTime),Ogre::Node::TS_WORLD);
didMove = true;
}
if (didMove != true) {
return false;
} else {
didMove = false;
}
mMoveTo = (targetNode->getOrientation() * ((mDirection * frameTime) - targetNode->getPosition()));
//mDirection.x = 0;
//mDirection.y = 0;
//mDirection.z = 0;
targetNode->translate(mMoveTo);
cam->lookAt(targetNode->getPosition());
//cam->setPosition();
std::cout << mMoveTo << "\n" << targetNode->getPosition() << "\n";
return true;
}
void InputHandler::setWindowExtents(int width, int height){
//Set Mouse Region.. if window resizes, we should alter this to reflect as well
const OIS::MouseState &ms = mMouse->getMouseState();
ms.width = width;
ms.height = height;
}
/*bool InputHandler::frameStarted(const Ogre::FrameEvent &evt) {
camNode->translate(mDirection * evt.timeSinceLastFrame, Ogre::Node::TS_LOCAL);
return true;
}*/
// MouseListener
bool InputHandler::mouseMoved(const OIS::MouseEvent &evt) {
if (evt.state.buttonDown(OIS::MB_Right)) {
camNode->pitch(Ogre:egree(-mRotate * evt.state.Y.rel), Ogre::Node::TS_LOCAL);
camNode->yaw(Ogre:egree(-mRotate * evt.state.X.rel), Ogre::Node::TS_WORLD);
cam->lookAt(targetNode->getPosition());
}
return true;
}
bool InputHandler::mousePressed(const OIS::MouseEvent &evt, OIS::MouseButtonID btn) {
return true;
}
bool InputHandler::mouseReleased(const OIS::MouseEvent &evt, OIS::MouseButtonID btn) {
return true;
}
// KeyListener
bool InputHandler::keyPressed(const OIS::KeyEvent &evt) {
if (evt.key == OIS::KC_UP || evt.key == OIS::KC_W) {
mMove = 100;
}
if (evt.key == OIS::KC_DOWN || evt.key == OIS::KC_S) {
mMove = -50;
}
return true;
}
bool InputHandler::keyReleased(const OIS::KeyEvent &evt) {
if (evt.key == OIS::KC_ESCAPE)
m_simulation->requestStateChange(SHUTDOWN);
if (evt.key == OIS::KC_F5) {
robotI++;
std::stringstream stream;
stream << "robot" << robotI;
std::string robotID = stream.str();
Ogre::Entity* ent1 = sMan->createEntity( robotID, "robot.mesh" );
Ogre::SceneNode* secondary = bNode->createChildSceneNode( robotID, Ogre::Vector3( randomNum(0,20), randomNum(0,20), (randomNum(0,20) - 500) ) );
std:: cout << robotID << "\n";
secondary->attachObject( ent1 );
}
if (evt.key == OIS::KC_F6) {
camNode->setOrientation(Ogre::Quaternion(-1,0,-.5,0));
}
if (evt.key == OIS::KC_UP || evt.key == OIS::KC_W) {
mMove = 0;
}
if (evt.key == OIS::KC_DOWN || evt.key == OIS::KC_S) {
mMove = 0;
}
return true;
}
// JoyStickListener
bool InputHandler::buttonPressed(const OIS::JoyStickEvent &evt, int index) {
return true;
}
bool InputHandler::buttonReleased(const OIS::JoyStickEvent &evt, int index) {
return true;
}
bool InputHandler::axisMoved(const OIS::JoyStickEvent &evt, int index) {
return true;
}
bool InputHandler:ovMoved(const OIS::JoyStickEvent &evt, int index) {
return true;
}[/Highlight]
Using Class.
Code:int IRandom(int min, int max){ // output random integer // get integer random number in desired interval int iinterval = max - min + 1; if (iinterval <= 0) return 0x80000000; // error int r = int(iinterval * Random()); // truncate if (r >= iinterval) r = iinterval-1; return min + r; } };
DannyIzHere (02-02-2011),flameswor10 (02-02-2011),GodHack2 (02-02-2011)
Jason (02-02-2011)
Last edited by whit+; 02-02-2011 at 11:49 AM.
Jason (02-02-2011)