Thread: RC Plane Script
View Single Post
  #10  
Old 09-01-2011, 02:21 AM
callimuc callimuc is offline
ジ
callimuc's Avatar
Join Date: Nov 2010
Location: Germany
Posts: 1,015
callimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to beholdcallimuc is a splendid one to behold
The basics of your script could look like:
PHP Code:
//#CLIENTSIDE
function onCreated() {
  
this.on = false;
  
onTimeOut();
}
function 
onWeaponFired() {
  if (
this.on == false) { //I know there are better ways but I still prefer this one, can´t tell why
    
this.on = true;
    
disabledefmovement();
  }
  else if (
this.on == true) {
    
this.on = false;
    
enabledefmovement(); //currently not sure if you can fire weapons while you are in disabledefmovement()
  
}
}

function 
onTimeOut() {
  if (
this.on == true) {
    for (
a = 0; a < 4; a++) {
      if (
keydown(a)) { //moving keys have been pressed
        
this.plane_x += vecx(a)*0.5; //normal players speed. change the *# to any number you want the speed to be
        
this.plane_y += vecy(a)*0.5; //same
        
this.plane_dir = k;
        
this.plane_ani = "YourAniNameHere"; //put in the flying gani name of your plane
      
}
      else 
this.plane_ani = "YourAniNameHere"; //put in the idle gani of your plane
    
}
    
DrawPlane(); //starting the event DrawPlane
    
settimer(0.05);
  }
}

function 
DrawPlane() { 
  
with (findimg(1)) {   
    
x = thiso.plane_x; 
    
y = thiso.plane_y; 
    
ani = thiso.plane_ani;
    
dir = thiso.plane_dir;
    
layer = 1; 
  }  
} 
Again couldn´t test it and just quick writed it so if there are any problems just tell me
__________________
MEEP!

Last edited by callimuc; 09-01-2011 at 02:38 AM..
Reply With Quote