Blockland Forums > Modification Help
Delays
Pages: (1/1)
Dr.Tyler O.:
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);
infiniteLoop:
You shouldn't do it like that..
Instead, do this
%obj.client.player.schedule(10000,setDataBlock,"HorseArmor");
dUMBELLS:
--- Quote from: Dr.Tyler O. on July 28, 2011, 09:16:28 PM ---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);
--- End quote ---
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: ---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
}
--- End code ---
Pages: (1/1)