hi guys
since a few hours i´ve holiday, I was happy and coded something...
it´s a cheat-input like GTA San Andreas. do you know it? - you can type in what you want and if you pressed a combination of characters (the cheat), a message appears and a piece of secret code will be executed. - now for 3DGS too
How to include...- copy the sa_input.wdl and the chtpcx.pcx in your project-folder
- include the code in your levelscript:
Code:
///////////////////////////////////////////////////////////////////////////////////
// GameStudio main script
////////////////////////////////////////////////////////////////////////////
// Files to over-ride:
...
include <lflare.wdl>; // remove when you need no lens flares
include <status.wdl>;
include <sa_input.wdl>;
////////////////////////////////////////////////////////////////////////////
// The engine starts in the resolution given by the follwing vars.
var video_mode = 6; // screen size 640x480
var video_depth = 16; // 16 bit colour D3D mode
...
- start the inkey_gtasa()-function (for example in your main-function):
Code:
function main()
{
// set some common flags and variables
// warn_level = 2; // announce bad texture sizes and bad wdl code
tex_share = on; // map entities share their textures
// center the splash screen for non-640x480 resolutions, and display it
splashscreen.pos_x = (screen_size.x - bmap_width(splashmap))/2;
splashscreen.pos_y = (screen_size.y - bmap_height(splashmap))/2;
splashscreen.visible = on;
// wait 3 frames (for triple buffering) until it is flipped to the foreground
wait(3);
// now load the level
level_load(level_str);
// freeze the game
freeze_mode = 1;
inkey_gtasa();
...
How to add your own cheat...Open the sa_input.wdl and scroll down. You´ll see an example-cheat:
Code:
if(str_stri(tmpcheat,"beepman")) { beep; str_cpy(tmpcheat,""); gtanim();}
and so you can add it:
- copy the line
- change the first white value ("beepman") into your cheat
- change the second white value ("beep;") into your cheat-function (the function which execute the secret code, like 'make player undieable')
NOTE: the str_cpy-command have to be excecuted, otherwise your cheat will be executed after every key-pressing again! / the gtanim();-function is not needed coactive. it shows only the message "cheat activated"
How to control the cheat-input...if the var "inkey_gtasa_active" is 1, the function works normally
if you change it to 0, the cheat-input will be stopped temporary (till you set it back to 1).
if you set it to -1, the inkey_gtsa-function will be terminated.
During the input the engine works normally. The function just notice all keystrokes and execute a function, if the combination of the keystrokes is a cheat!How to get the code...Just click
here Have a nice day
- Tempelbauer
ps: please give me feedback and report bugs. thanks