moving a player like a brick

Author Topic: moving a player like a brick  (Read 3411 times)

How would i script it so if i type in "/moveplayer (playername)" that I can move a player like a brick.  so far i have
this:
Code: [Select]
package Playerbrick
{
function serverCmdMovePlayer(%client, %text)
{
if (%client.isadmin && isplayer(%player))
{
%playername = getword(%text, 0)
%victim = findplayerbyname(%text, 0)
%x = getword(%text, 1)
%y = getword(%text, 2)
%z = getword(%text, 3)

%victim.player.position = %player.position.x + %x;
%victim.player.position = %player.position.y + %y;
%victim.player.position = %player.position.z + %z;
Messageall(%victim, "is being move by", %client)
};


}

}
}
ActivatePackage(Playerbrick);

note: I just used commands here.
p.s: i am also told serverCmdmoveplayer dosn't exist
*edit
« Last Edit: February 11, 2008, 02:02:43 PM by zmaster »

%x, %y, and %z for a start =P

This should work:
Code: [Select]
package PlayerBrick
{
function serverCmdMovePlayer(%client, %name, %x, %y, %z)
{
if(!%client.isAdmin && !%client.isSuperAdmin)
return;
%player = findPlayerByName(%name).player;
if(!isObject(%player))
return;
%player.setTransform(%x SPC %y SPC %z SPC getWords(%player.getTransform(), 3, 6));
Messageall('', "%1 was moved by %2.", %victim.name, %client.name);
}
};
ActivatePackage(PlayerBrick);

This should work:
Code: [Select]
package PlayerBrick
{
function serverCmdMovePlayer(%client, %name, %x, %y, %z)
{
if(!%client.isAdmin && !%client.isSuperAdmin)
return;
%player = findPlayerByName(%name).player;
if(!isObject(%player))
return;
%player.setTransform(%x SPC %y SPC %z SPC getWords(%player.getTransform(), 3, 6));
Messageall('', "%1 was moved by %2.", %victim.name, %client.name);
}
};
ActivatePackage(PlayerBrick);

that would make him have to type it on console, he wants to move him like a ghost brick.


Or, you could do this:

%controllingPlayer.tempBrick = %controlledPlayer;

Then you'll just need to package out the fire method for the brick weapon and the fxDTSBrick::Plant() method to make sure it doesn't crash the game when you "plant" or "place" the player.

Can you go through this step by step?

Code: [Select]
package MovePlayer
{
function serverCmdMovePlayer(%client, %controllingPlayer)
{
if!%client.isAdmin || !%client.isSuperAdmin
return;
%player = findclientByName(%name).player;
if !isObject(%player)
return;
%controllingPlayer.tempBrick = %controlledPlayer;
return;

}
};
ActivatePackage(MovePlayer);
« Last Edit: February 12, 2008, 12:49:42 PM by zmaster »

This will get you started.  You'll still need to package out the methods I mentioned in my previous post.  This endeavor might be a little too much for you to handle.

Anyway, use it like this: /controlPlayer Trader

Code: [Select]
function serverCmdControlPlayer(%client,%name)
{
if(%client.isAdmin || %client.isSuperAdmin)
{
%victim = findClientByName(%name);

if(isObject(%victim) && isObject(%victim.Player) && isObject(%client.Player))
{
if(isObject(%client.Player.tempBrick))
{
%client.Player.tempBrick.delete();
}

%client.Player.tempBrick = %victim.Player;
}
}
}

You might also want to prevent the player from controlling himself while you're in control.

Like I said, this is probably way more advanced than what you're ready to handle.
« Last Edit: February 12, 2008, 12:49:40 PM by Trader »

i keep getting unknown command

Put the code I gave you into a file called Script_ControlPlayer.cs and put the file in Add-Ons.

Then enable the Add-On and start a server.  Then try /controlPlayer Trader again.


Check the console for errors.


Like I said, this is probably way more advanced than what you're ready to handle.

I was on Triguns server yesterday and he had something like that that he used on me.