| Blockland Forums > Modification Help |
| how would i slow a for statement? |
| << < (3/5) > >> |
| Placid:
--- Quote from: phflack on August 27, 2010, 06:22:18 PM ---true, i might go do that, basicaly that's the client.cs, and then add a description.txt and put it in client_eatcommand? edit: i can put multiple functions in the same client.cs, right? --- End quote --- i don't think you need to have it in a client.cs, it doesn't matter. It's still a function whether it's in a server file or a client file. Yes, you can have multiple functions; make sure they're separated. you can just call it "Script_eatcommand", but you could call it client_eatcommand. It's all up to you. |
| phflack:
ok |
| phflack:
so, i have this in client_commands, and for some reason it won't work --- Code: ---function eat(%i) { commandtoserver('consume',"purifiedwater"); commandtoserver('consume',"banana"); if(%i != "stop") { $eatsched=schedule(10000,0,eat); } else { cancel($eatsched); } } function countdown(%a, %b) { if(%b >= 0) { commandtoserver('messagesent', %b); %b--; if(%a >= 1) { $countdownsched=schedule(5000, 0, countdown); } else { cancel($countdownsched); } } } function bottlesofspam(%a, %b) { if(%b >= 0) { if(%c >= 3) { %c = 1; %b--; } else { %c++; } switch(%c) { case 1: commandtoserver('messagesent', %b @ " bottles of spam on the wall."); break; case 2: commandtoserver('messagesent', %b @ " bottles of spam!); break; case 3: commandtoserver('messagesent', "Take one down, unleash the spam..."); break; } if(%a >= 0) { schedule(%a, 0, bottlesofspam); } } } --- End code --- the eat thing i think works fine, but the count down only displays %b, then spams commandtoserver('messagesent');, and then the bottles of spam won't work at all, and it says it has errors in the code |
| Scout31:
[ --- Code: ---function eat(%i) { commandtoserver('consume',"purifiedwater"); commandtoserver('consume',"banana"); if(%i != "stop") { $eatsched=schedule(10000,0,eat,%i); } else { cancel($eatsched); } } function countdown(%a, %b) { if(%b >= 0) { commandtoserver('messagesent', %b); %b--; if(%a >= 1) { $countdownsched=schedule(5000, 0, countdown,%a,%b); } else { cancel($countdownsched); } } } function bottlesofspam(%b, %c) { if(%b >= 0) { if(%c >= 3) { %c = 1; %b--; } else { %c++; } switch(%c) { case 1: commandtoserver('messagesent', %b @ " bottles of spam on the wall."); break; case 2: commandtoserver('messagesent', %b @ " bottles of spam!); break; case 3: commandtoserver('messagesent', "Take one down, unleash the spam..."); break; } if(%b >= 0) { schedule(1000, 0, bottlesofspam, %b, %c); } } } --- End code --- Think that should work |
| Scout31:
Edit: Phail double post |
| Navigation |
| Message Index |
| Next page |
| Previous page |