| Blockland Forums > Modification Help |
| Is there some way to make a delay? |
| << < (3/4) > >> |
| Jetpuff:
I did and I said it didn't do anything. Neither codes worked gentlemen. I guess I could try Chrono's in a second again though, might have put it in wrong. Ok I executed from a file this time, neither truly work. Even though the echoes are correct, I see some things wrong with both: Chrono - I think spawnPlayer is built for if the player is not an object. Truce - Like Chrono said, the schedule doesnt exist anymore after the first spawn. Jetpuff - You are bad at scripting. So here is what I thought of, make another schedule to kill the object then spawn the object. I am too lazy to try right now, but could anyone tell me if they would agree with that? (Also thanks for all the help you guys have put toward this question.) |
| Chrono:
Spawn player deletes any existing player before doing the rest of the function. I know because I use it in the console all the time when I want people to stop bothering me. |
| phflack:
--- Quote from: Chrono on December 07, 2010, 10:44:30 PM ---Spawn player deletes any existing player before doing the rest of the function. I know because I use it in the console all the time when I want people to stop bothering me. --- End quote --- hmm, i've been using instantrespawn, spawnplayer works? i thought that i had tried it before |
| Uristqwerty:
In this case, you would want to repeat finding the player at the time that it is respawned, so the code you want is either a function that schedules itself, or perhaps something like this: --- Code: ---for(%i=0; %i<120; %i++) schedule(1000 * %i, 0, eval, "findclientbyname(\"jet\").player.instantRespawn();"); --- End code --- But the better way to do it would be --- Code: ---function whatever(%i) { if(%i < 1) return; if([conditions]) findclientbyname("jet").player.instantRespawn(); schedule(1000, 0, whatever, %i - 1); } --- End code --- because then you can easily add conditions to it, or other fancy things. Finally, it should be rewritten like this: --- Code: ---function whatever(%i) { if(%i < 1) return; %client = findclientbyname("jet"); if(isObject(%client) && isObject(%client.player) [&& optional extra conditions]) %client.player.instantRespawn(); schedule(1000, 0, whatever, %i - 1); } --- End code --- because that way it doesn't give errors if the client or player don't exist. |
| Chrono:
In that last bit, you only need isObject(%client.player), not isObject(%client) Because if the client doesn't exist, then .player sure wont. |
| Navigation |
| Message Index |
| Next page |
| Previous page |