Author Topic: Any way to force consoel commands on a player?  (Read 2640 times)

Is it possible to make a client mousefire(1); via any functions? I specifically want walk(1); so I can toggle it on/off. Thanks


Server-sided or client-sided? The server can't force the client to input console commands, but sometimes there are ways to emulate the effects server-sidedly.

For walking, there's no explicit "%player.walk(true);" method, but I'm pretty sure you can control the player with an AIConnection or temporarily replace them with an AIPlayer, but I haven't dealt with that in awhile.

A client side add-on would work.

No, but what exactly are you trying to do? For mouse fire could call server side functions that clicking triggers; player::activatestuff (I think that's the name), weaponimage::onfire, etc
For walk you could use aiplayers as otto said
« Last Edit: August 28, 2013, 10:09:05 PM by Headcrab Zombie »

No, but what exactly are you trying to do? For mouse fire could call server side functions that clicking triggers; player::activatestuff (I think that's the name), weaponimage::onfire, etc
For walk you could use aiplayers as chrono said
otto-san isn't chrono right?
also I know that activateStuff is a server command I'm not sure if it's linked to the player aswell
it is
« Last Edit: August 28, 2013, 08:27:15 PM by swollow »

otto-san isn't chrono right?
I have no idea where I got chrono from

Is it possible to make a client mousefire(1); via any functions? I specifically want walk(1); so I can toggle it on/off. Thanks
You can't do this entirely server-sided. The best way would be to make a client-sided add-on to go along with your server script.

EXAMPLE SERVER:
Code: [Select]
CommandToClient(%client,'doMouseFire', true);

EXAMPLE CLIENT:
Code: [Select]
function ClientCmddoMouseFire(%arg)
{
mouseFire(%arg);
}

Nothing you guys suggested worked with walk();, and I do have a client if anyone has other solutions

Nothing you guys suggested worked with walk();, and I do have a client if anyone has other solutions
Your not using them right.

Nothing you guys suggested worked with walk();, and I do have a client if anyone has other solutions
Do you mean moveForward(1); ?

Do you mean moveForward(1); ?

Sadly no, I actually want walk(1); so it will slow down the client's player. My server scripts are as follows:
Code: [Select]
package crpg_ChangeGears
{
function Armor::onTrigger(%this,%obj,%slot,%on)
{
%client = %obj.client;

if(%on && %slot == 0) //slot 4 is activated by right clicking
{
if($CRPG::isWalking $= "true")
{
commandtoClient(%client,'crpg_ChangeGear', false);
warn("Add-Ons/Gamemode_GRPG/rp/RP_Core/user.cs (931): commandtoClient(%client,'crpg_ChangeGear', false);");
}
else
{
commandToClient(%client,'crpg_ChangeGear', true);
warn("Add-Ons/Gamemode_GRPG/rp/RP_Core/user.cs (936): commandtoClient(%client,'crpg_ChangeGear', true);");
}
}

parent::onTrigger(%this,%obj,%slot,%on);
}
};
activatePackage(crpg_ChangeGears);

In game when I use slot 0/left click it does echo that the changeGear has been set to true, but it says that every single time I use slot 0.

The client code:
Code: [Select]
function clientcmdcrpg_ChangeGear(%arg)
{
//walk(%arg);

walk(true);
walk(1);
echo(ImWalkingNerd);
$CRPG::isWalking = %arg;
}

At this point I just tried forcing it to be true regardless of whether or not it is being toggled off or on, and it never echos that it is walking.
« Last Edit: August 30, 2013, 09:05:17 PM by Gordo12699 »

Oh, I totally confused moveForward() and walk(). Stupid me. It's totally possible to do that serverside.

Code: [Select]
datablock playerData(PlayerWalkArmor:PlayerStandardArmor)
{
    maxForwardSpeed = 2.62;
    maxBackwardSpeed = 2.62;
    maxSideSpeed = 2.62;
    maxForwardCrouchSpeed = 1.21;
    maxBackwardCrouchSpeed = 1.21;
    maxSideCrouchSpeed = 1.21;
};

Then, to make them 'walk', %player.setDatablock(PlayerWalkArmor);

That wouldn't slow down the vehicle, try driving and enabling walk(1); in console

Change the client side variables $mvMoveForward and $mvMoveBackward to decimal values between 0 and 1 to change speed.