Blockland Forums > Modification Help
Need help with input!
Swollow:
function ServerCmdEnableAddon(%Client,%Addon)
{
//Return; means to exit so were exiting the command
//"GetNumKeyID" means the host ID so we are comparing it to the clients id
if(%Client.bl_id != getNumKeyID();)
return;
//This checks if the Server.cs exists
if(!isFile("add-ons/"@%Addon@"/server.cs"))
return;
//This enables the Server.cs
exec("add-ons/"@%Addon@"/server.cs");
//This announces it
announce("Host is enabling\c3" SPC %Addon);
}
there wasn't supposed to be a semi colon right here
if(!isFile("add-ons/"@%Addon@"/server.cs"));
when an addon has syntax errors make sure you check where it says those syntax errors are
I-have-not:
--- Quote from: swollow on January 26, 2012, 10:45:11 PM ---function ServerCmdEnableAddon(%Client,%Addon)
{
//Return; means to exit so were exiting the command
//"GetNumKeyID" means the host ID so we are comparing it to the clients id
if(%Client.bl_id != getNumKeyID();)
return;
//This checks if the Server.cs exists
if(!isFile("add-ons/"@%Addon@"/server.cs"))
return;
//This enables the Server.cs
exec("add-ons/"@%Addon@"/server.cs");
//This announces it
announce("Host is enabling\c3" SPC %Addon);
}
there wasn't supposed to be a semi colon right here
if(!isFile("add-ons/"@%Addon@"/server.cs"));
when an addon has syntax errors make sure you check where it says those syntax errors are
--- End quote ---
It doesn't! I'm doing the whole thing on my server in the console!
Nexus:
--- Quote from: swollow on January 26, 2012, 10:45:11 PM ---function ServerCmdEnableAddon(%Client,%Addon)
{
//Return; means to exit so were exiting the command
//"GetNumKeyID" means the host ID so we are comparing it to the clients id
if(%Client.bl_id != getNumKeyID()##;##)
return;
//This checks if the Server.cs exists
if(!isFile("add-ons/"@%Addon@"/server.cs"))
return;
//This enables the Server.cs
exec("add-ons/"@%Addon@"/server.cs");
//This announces it
announce("Host is enabling\c3" SPC %Addon);
}
there wasn't supposed to be a semi colon right here
if(!isFile("add-ons/"@%Addon@"/server.cs"));
when an addon has syntax errors make sure you check where it says those syntax errors are
--- End quote ---
Also you should have it announce before actually executing the file. That is a massive flaw with the eval mod that is going around, because if the evaluated code is malicious and crashes the server, the echo or message that would tell people who did it never shows up.
Also make it try a discoverfile() before returning to see if the host maybe just added a new add-on while the server was up.
Swollow:
this is used by the host though so I didn't really think it was necessary
Also I usually make a bunch of mistakes when coding something
I-have-not:
--- Quote from: Nexus on January 26, 2012, 10:57:20 PM ---Also you should have it announce before actually executing the file. That is a massive flaw with the eval mod that is going around, because if the evaluated code is malicious and crashes the server, the echo or message that would tell people who did it never shows up.
Also make it try a discoverfile() before returning to see if the host maybe just added a new add-on while the server was up.
--- End quote ---
Why is there a semicolon between the 4 #s?