Author Topic: Executing a server cmd through a client through server scripts?  (Read 920 times)

I have this command
Code: [Select]
%player.client.commandToServer('prevSeat'); but I don't know how to make %player execute the command, when I run the script nothing happens. Does anyone know how to do this?

servercmdprevseat(%player.client);

Doing this crashes the server when isCuffed = 1;
Code: [Select]
function Armor::onMount(%client, %player, %mount, %mountClient)
{
parent::onMount(%client, %player, %mount, %mountClient);
if(%mount.getClassName() $= "WheeledVehicle")
{
if(%player.getDatablock().isCuffed)
{
servercmdPrevSeat(%player.client);
}
}
}

Edit: It IS in a package

Any idea why?
« Last Edit: March 02, 2014, 07:14:10 PM by Gordo12699 »

You don't do variables on datablocks. Try %player.isCuffed instead.

Still crashes the server.. :/

You don't do variables on datablocks.
um yes you can

I'm gonna take a guess that the problem is onMount is called when switching seats so you are creating an endless loop of switching seats, crashing the server
so you should check to make sure that they are in the driver's seat by using the %player.isPilot() function, also should beware of the fact that a vehicle they might get into might only have one seat resulting in the endless loop again, so you might want checks for that too
« Last Edit: March 03, 2014, 12:51:41 AM by swollow »

um yes you can
Yes, but people that use the same datablock will have the same variable.