Blockland Forums > Modification Help
Need help with input!
Swollow:
also people will usually crash if they don't have an addon that uses sounds, models, music, or images
I-have-not:
Well my friend gave me something that updates the data blocks at my server, but it only worked for him! He got slanted bricks when I ran the function but I did not, this probably means hosts don't get it, but players do:
--- Code: ---function updateclientdatablocks()
{
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%client.reloadDatablocks = true;
%client.transmitDataBlocks($missionSequence);
}
}
--- End code ---
IN ADDITION TO:
--- Code: ---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
announce("\c0Host is enabling\c3" SPC %Addon);
exec("add-ons/"@%Addon@"/server.cs");
//This announces it
if(!copmile("add-ons/Script_EnableAddon/server.cs"))
{
warn("Contains syntax errors!");
}
announce("\c0Updating datablocks for" SPC %Addon);
exec("add-ons/Script_updateClientDatablocks/server.cs");
}
--- End code ---
Any help please?
I-have-not:
Anyone?
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;
//Move the Compile to check for syntax errors before we execute it and make it return the function if it has syntax errors
if(!copmile("add-ons/@%Addon@/server.cs"))
{
return warn("Contains syntax errors!");
}
//This enables the Server.cs
announce("\c0Host is enabling\c3" SPC %Addon);
exec("add-ons/"@%Addon@"/server.cs");
//We don't want to check for syntax errors AFTER we have enabled it
if(!copmile("add-ons/@%Addon@/server.cs"))
{
warn("Contains syntax errors!");
}
//This should call the update client function
updateclientdatablocks();
//We're not going to execute the Server.cs a second time
announce("\c0Updating datablocks for" SPC %Addon);
exec("add-ons/Script_updateClientDatablocks/server.cs");
}
function updateclientdatablocks()
{
for (%i = 0; %i < ClientGroup.getCount(); %i++)
{
%client = ClientGroup.getObject(%i);
%client.reloadDatablocks = true;
%client.transmitDataBlocks($missionSequence);
}
}