Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Code Gallery
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 12-24-2006, 06:29 PM
michael7849 michael7849 is offline
Playerworld21 Manager
Join Date: Aug 2006
Posts: 81
michael7849 is an unknown quantity at this point
Human controller Kinda abusive

hi this is mike and heres a code for you all a controller a little buggy but gets the point around (i use to for the ppl that are liek speed hacking and stuff and make them walk to te jail


PHP Code:
function onActionServerside(cmdplayerdirection)
  {
  
pl findplayer(params[1]);
  
with (pl) {
    if (
cmd == "on"freezeplayer2();
    if (
cmd == "off"unfreezeplayer();
    if (
cmd == "ani"setani(params[2],params[3]);
    if (
cmd == "chat"pl.chat params[2];
    if (
cmd == "move")
      {
      if (
direction == 0)
        {
        
this.speed .45;
        
pl.-= this.speed;
        
pl.dir 0;
        
setani("walk","");
        
sleep(.30);
        
setani("idle","");
      }
      if (
direction == 2)
        {
        
pl.+= this.speed;
        
pl.dir 2;
        
setani("walk","");
        
sleep(.30);
        
setani("idle","");
      }
      if (
direction == 3)
        {
        
pl.+= this.speed;
        
pl.dir 3;
        
setani("walk","");
        
sleep(.30);
        
setani("idle","");
      }
      if (
direction == 1)
        {
        
pl.-= this.speed;
        
pl.dir 1;
        
setani("walk","");
        
sleep(.30);
        
setani("idle","");
      }
    }
  }
}
//#CLIENTSIDE

function onMouseDown(button)
  {
  if(
button == "double")
    {
    
temp.pl GetPlayer(mousex,mousey);
    
this.ctrl temp.pl;
    
with(findImg(200)) {
      
text "Mind Control:" SPC temp.pl SPC "press (c) to control and stop controlling";
      
font "Tempus Sans ITC";
      
style "b";
      
zoom 0.6;
      
screenwidth gettextwidth(zoomfontstyletext) - 220;
      
135;
      
layer 5;
    }
    
    for(
temp.i=0;temp.i<4;temp.i++) {
      
with(findImg(201+temp.i)) {
        
text findImg(200).text;
        
font findImg(200).font;
        
style findImg(200).style;
        
zoom findImg(200).zoom;
        
findImg(200).vecx(temp.i);
        
findImg(200).vecy(temp.i);
        
layer 4;
        
        
red 0;
        
green 0;
        
blue 0;
        
alpha 1;
      }
    }
    
with(findImg(206)) {
      
text findImg(200).text;
      
font findImg(200).font;
      
style findImg(200).style;
      
zoom findImg(200).zoom;
      
findImg(200).2;
      
findImg(200).2;
      
layer 4;
      
      
red 0;
      
green 0;
      
blue 0;
      
alpha 1;
    }
    if (
this.ctrl == NULLhideimgs(200,300);
  }
}

function 
GetPlayer(tXtY) {
  for(
temp.i=0;temp.i<players.size();temp.i++) {
    
//return players[i].account;
    
if(tX in |players[i].x,players[i].x+3| && tY in |players[i].y,players[i].y+3|) {
      if(
players[i].account != player.account) {
        return 
players[i].account;
      } else {
        return 
"";
      }
    }
  }
  return 
"";
}


function 
onPlayerChats()
  {
  if (
this.on == 1)
    {
    
triggeraction(0,0,"serverside"#N,"chat",this.ctrl,player.chat);
    
player.chat "";
  }
}

function 
onKeyPressed(keycharcharacter)
  {
  if (
this.on == 1)
    {
    
//this.msg = this.msg@character; 
    
if (keychar == 13
    {
      
onCtrlBar();
      
//triggeraction(0,0,"serverside", #N,"chat",this.ctrl,this.msg);
      //this.msg = "";
    
}
    if (
character == "a"triggeraction(0,0,"serverside"#N,"ani",this.ctrl,"grab");
    
if (character == "h"
    {
       
showimg(1,"emoticon_heart.png",pl.2,pl.5);
       
changeimgvis(1,2);
       
sleep(.30);
       
onTimeout();
       
hideimg(1);
    }
    if (
character == "s"triggeraction(0,0,"serverside"#N,"ani",this.ctrl,"sword");
  
}
  if (
character == "c")
    {
    
onTimeout();
    if (
this.ctrl != NULL)
      {
      
this.on = !this.on;
      if (
this.on 0)
        {
        
hideimgs(200,300);
        
resetfocus();
        
triggeraction(0,0,"serverside"#N,"off",this.ctrl);
        
this.ctrl NULL;
      }else {
        
setani("idle","");
        
triggeraction(0,0,"serverside"#N,"on",this.ctrl);
      
}
    }
  }
}

function 
onTimeout()
  {
  if (
this.on == 1)
    {
    
ChatBar.visible false;
    
disabledefmovement();
    for (
i=0;i<4;i++;)
      {
      if (
keydown(i))
        {
        
triggeraction(0,0,"serverside"#N,"move",this.ctrl,i);
      
}
    }
    
pl findplayer(this.ctrl);
    
setfocus(pl.x,pl.y);
  }else 
enabledefmovement();
  
setTimer(.05);
}

function 
onCtrlBar()
{
  new 
GuiTextEditCtrl(Chat_bar) { 
    
profile =     profile "GuiBlueTextEditProfile";
    
horizSizing "width";
    
vertSizing "top";
    
position "100 370";
    
extent "488 20";
    
historySize 100;
    
tabComplete true;
  }
}

function 
Chat_bar.onAction()
{
  
triggeraction(0,0,"serverside"#N,"chat",this.ctrl,Chat_bar.text);
  
Chat_bar.destroy();

Attached Thumbnails
Click image for larger version

Name:	mind control.PNG
Views:	561
Size:	208.5 KB
ID:	39035  
__________________
Graal Account: michael7849
Graal Nick: element
AIM: Garbagemonkey32
MSN: [email protected]
Email: [email protected]
Server: Playerworld21

PRIVATE MESSAGE ME HERE

Buddy me

My profile

Last edited by Darlene159 : Today at 12:30AM. Reason: Added more spam to your post.

Stefan you need to read your pms more...

G OTO MY myspace.com/mikeandu

YES I AM EMO/GOTH
Reply With Quote
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 11:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.