assistance with a /save command
function ccSave(%sender, %args) { %group = nameToID("MissionCleanup/Deployables"); %count = %group.getCount(); for (%i=0;%i<%count;%i++) { %obj = %group.getObject(%i); if (%obj.getOwner() == %sender) %title = getword(%args, 0); %file = %sender.nameBase @ "/" @ %title; } SaveBuilding(%sender, %obj, %file, 1, 0); messageAll('MsgAdminForce', "\c3"@%sender.nameBase@"\c2 is saving his buildings."); messageClient(%sender, "", "\c2Building saved to "@$SaveBuilding::LastFile@"."); }
the issue is it saves everyones pieces, not just %sender 's
how do i fix this?
thanks
Comments
Essentially what you're trying to do, you would do with
Also, don't put your title/filename selection in the loop, or it will set it every time untill it's finished.
Plus, only setting %title as %args if it finds a piece belonging to the sender with "if (%obj.getOwner() == %sender) %title = getword(%args, 0);" is a bit silly.
and it doesnt save anything.
is it openforappend?
Still UE's, and saves nothing...
Edit: Well, actually, I think that one was modified a bit by Blnukem, but yeah.