Thread: Help:Jetpack
View Single Post
  #3  
Old 01-05-2011, 03:47 AM
fowlplay4 fowlplay4 is offline
team canada
fowlplay4's Avatar
Join Date: Jul 2004
Location: Canada
Posts: 5,200
fowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond reputefowlplay4 has a reputation beyond repute
Use PHP tags instead of QUOTE tags.

It's a logical mess.

Here.. have a scripting puzzle.

Here's the bare-bones for a weapon you turn on and off, and one of the ones you can check for keys being held down.

PHP Code:
//#CLIENTSIDE

function onWeaponFired() {
  
// Check if weapon is on
  
if (this.on) {
    
// Notify player of change
    
player.chat "Weapon is now OFF!";
    
// Set on flag to false/off
    
this.on false;
  } else {
    
// Notify player of change
    
player.chat "Weapon is now ON!";
    
// Set on flag to true/on
    
this.on true;
    
// Start Looping
    
setTimer(0.05);
  }
}

// When the time runs out in setTimer, it causes a timeout.
// Which triggers the onTimeout function/event.
function onTimeout() {
  
// Check for Keys being Held Down
  
if (keydown(6)) {
    
player.chat "IM PRESSING GRAB NOW LOL";
  }
  else if (
keydown(5)) {
    
player.chat "IM PRESSING ATTACK NOW LMAO";
  }
  
// Continue Looping / Timing out while On
  
if (this.onsetTimer(0.05);

You can control the z-axis by calling these functions:

PHP Code:
//#CLIENTSIDE

function raise_z() {
  
// Raise Z
  
player.+= 0.05;
  
// Check if over Maximum Height
  
if (player.10player.10;
}

function 
lower_z() {
  
// Lower Z
  
player.-= 0.05;
  
// Check if under Minimum Height
  
if (player.0player.0;
}

function 
reset_z() {
  
// Resets Player Z value
  
player.0;

Make a Jetpack out of it.
__________________
Quote:

Last edited by fowlplay4; 01-05-2011 at 03:59 AM..
Reply With Quote