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(cmd, player, direction)
{
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.y -= this.speed;
pl.dir = 0;
setani("walk","");
sleep(.30);
setani("idle","");
}
if (direction == 2)
{
pl.y += this.speed;
pl.dir = 2;
setani("walk","");
sleep(.30);
setani("idle","");
}
if (direction == 3)
{
pl.x += this.speed;
pl.dir = 3;
setani("walk","");
sleep(.30);
setani("idle","");
}
if (direction == 1)
{
pl.x -= 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;
x = screenwidth - gettextwidth(zoom, font, style, text) - 220;
y = 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;
x = findImg(200).x + vecx(temp.i);
y = findImg(200).y + 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;
x = findImg(200).x + 2;
y = findImg(200).y + 2;
layer = 4;
red = 0;
green = 0;
blue = 0;
alpha = 1;
}
if (this.ctrl == NULL) hideimgs(200,300);
}
}
function GetPlayer(tX, tY) {
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(keychar, character)
{
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.x + 2,pl.y - 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();
}