| Blockland Forums > Modification Help |
| Respawn time |
| (1/1) |
| Eryehk:
How can i make it so the players cant respawn in a certain ammount of time. |
| Aloshi:
For this you must modify a few things. First, we make it so a schedule starts when you die... --- Code: ---package TimedRespawn1 { function Armor::onDisabled(%this,%obj,%state){ %client = %obj.client; %client.canspawn = 0; schedule(5000,0,"AllowRespawn",%client); //Change 5000 to whatever you want, its the time parent::onDisabled(%this,%obj,%state); } }; activatepackage(TimedRespawn); --- End code --- Then make a function to set a variable to 1 that will be read on spawn to allow spawning... --- Code: ---function AllowSpawn(%client){ %client.canspawn = 1; } --- End code --- Then modify the spawnplayer function to only work when you can spawn... --- Code: ---package TimedRespawn2 { function GameConnection::spawnPlayer(%this) { if(%this.canspawn == 1){ parent::spawnPlayer(%this); %this.canspawn = 0; //Reset it to 0 so you dont spawn next time }else{ commandtoclient(%this,'centerPrint',"You cannot spawn yet!",1.5); //Tells the client they cant spawn } } }; activatepackage(TimedRespawn2); --- End code --- Ought to work...untested. |
| Rolland:
--- Quote from: Aloshi on June 26, 2007, 09:25:57 AM --- --- Code: ---package TimedRespawn1 { function Armor::onDisabled(%this,%obj,%state){ %client = %obj.client; %client.canspawn = 0; schedule(5000,0,eval,"%client.canspawn = 1;"); //Change 5000 to whatever you want, its the time parent::onDisabled(%this,%obj,%state); } }; activatepackage(TimedRespawn); --- End code --- --- End quote --- That makes no need for a new command :P plus, no one can change it to be evil unless the host does so, and the point of it being evil would be the client doing it...I've been learning to script --- Quote from: Aloshi on June 26, 2007, 09:25:57 AM --- --- Code: ---package TimedRespawn2 { function GameConnection::spawnPlayer(%this) { if(%this.canspawn == 1){ parent::spawnPlayer(%this); %this.canspawn = 0; //Reset it to 0 so you dont spawn next time }else{ commandtoclient(%this,'centerPrint',"You cannot spawn yet!",1.5); //Tells the client they cant spawn } } }; activatepackage(TimedRespawn2); --- End code --- Ought to work...untested. --- End quote --- Wouldn't that not let people who spawn after loading from joining not spawn at all? |
| Navigation |
| Message Index |