Author Topic: Delays  (Read 429 times)

OK so i'm working on a script and a player is suppost to turn into a player type and then turn back after 10 seconds so whats wrong here -
schedule(10000,0,%obj.client.player.setDataBlock("HorseArmor"),%obj.client);

You shouldn't do it like that..

Instead, do this

%obj.client.player.schedule(10000,setDataBlock,"HorseArmor");

OK so i'm working on a script and a player is suppost to turn into a player type and then turn back after 10 seconds so whats wrong here -
schedule(10000,0,%obj.client.player.setDataBlock("HorseArmor"),%obj.client);

The thing that is wrong here is that %obj shouldn't have .client after it, assuming that it already represents the client. Also, you don't need any args after the datablock name when using setDataBlock.

Here's a working script:
Code: [Select]
function serverCmdBecomeHorse(%client)
{
%player=%client.player;
%old=%player.dataBlock.getName(); // stores the original datablock's name for later
%player.setDataBlock("HorseArmor"); // makes the player a horse, this could also be anything else
%player.schedule(10000,"setDataBlock",%old); // turns the player back after 10 seconds
}