Feel free to critique, not sure if it's "code" gallery material (probably not, but might be interesting to have up regardless) . I haven't seen a typewriter script up yet though. Pretty much the same thing on UN (not leeched though).
PHP Code:
//#CLIENTSIDE
function onKeyPressed(code) {
if (keydown(8) || temp.code == 9 && this.on){
setTimer(0.05); // checking if pressed && looping
} else {
setTimer(0);
}
}
function onTimeout() {
if (ChatBar.visible && this.on) { // if chatbar visible && on
temp.text = ChatBar.text; // define var
if (temp.text != null) {
player.chat = temp.text; // send player.chat directly, looping
}
setTimer(0.05);
}
}
function onWeaponFired(){
if (!this.on){
this.on = true;
player.chat = "Typewriter on!"; // aesthetics
}else if(this.on){
this.on = false;
player.chat = "Typewriter off!";
}
}
EDIT: Oops, was looping for no real good reason.
PHP Code:
//#CLIENTSIDE
function ChatBar.onTextChanged(temp.text) {
if (this.on) {
player.chat = temp.text;
}
}
function onWeaponFired(){
this.on = ! this.on;
player.chat = "Typewriter " @ (this.on ? "on" : "off") @ "!";
}