| Blockland Forums > Modification Help |
| Trying to make a help pop up on spawn. Need help! |
| (1/1) |
| NomAplemNom:
I am trying to make a mod where when you spawn help pops up inside a message ok box. I wrote out the code and it shows up inside the addons list. But when I start the server it does not show up. I will post the console maybe later. But can someone who is better check this following .cs file for me? --- Code: ---$Help_File = "config/server/Help.txt"; function loadHelpFile() { %file = new fileObject(fileStream); %file.open.ForRead($Rules_File); %file.readLine(); //for some reason, isFile is not working if (%file.isE0F()) { %from = new fileObject(); %to = new fileObject(); %from.openForRead("Add-ons/Server_Help/defaultHelp.txt"); %to.openForWrite($Help_File); while(!%from.isEOF()) %to.writeLine(%from.readLine()); %to.close(); %from.close(); %to.delete(); %from.delete(); } %file.close(); %file.delete(); %file = new FileObject(); %file.openForRead($Help_File); $Help_Title = %file.readLine(); $Help_Body = %file.readLine(); while(!%file.isEOF()) $Help_Body = $Help_Body NL %file.readLine(); %file.close(); %file.delete(); } package Help { function GameConnection::OnClientEnterGame(%this) { %this.schedule(2500, sendHelp); Parent::OnClientEnterGame(%this); } function GameConnection::sendHelp(%this) { commandToClient(%this,'MessageBoxOK', $Help_Title, $Help_Body); } }; activatePackage(Help); function ServerCmdHelp%client) { %client.sendHelp(); } function ServerCmdHelpAll(%client) { if(%client.isSuperAdmin) for(%c = 0; %c < ClientGroup.getCount(); %c++) ClientGroup.getObject(%c).sendHelp(); } function ServerCmdReloadHelp(%client) { if(%client.isSuperAdmin) loadHelpFile(); } loadHelpFile(); --- End code --- Please help! Thanks! |
| rkynick:
Don't think you can use files that aren't in the add-on's folder (configs/server/help.txt, for example, is probably unusable) |
| Headcrab Zombie:
--- Quote from: rkynick on July 06, 2010, 03:20:25 AM ---Don't think you can use files that aren't in the add-on's folder (configs/server/help.txt, for example, is probably unusable) --- End quote --- You can, A few of my add-ons read a file in config/server/ |
| Bauklotz:
--- Quote from: NomAplemNom on July 06, 2010, 02:37:37 AM --- --- Code: --- if (%file.isE0F()) --- End code --- --- End quote --- --- Code: --- if (!%file.isEOF())ยจ --- End code --- Yoo forgot a !, and don't do E0F, but EOF. |
| NomAplemNom:
--- Quote from: Headcrab Zombie on July 06, 2010, 03:59:13 AM ---You can, A few of my add-ons read a file in config/server/ --- End quote --- How to do? Oh and thanks Bauk. |
| Navigation |
| Message Index |