Serverside
PHP Code:
this.serverName = "server";
this.lngArray = {"de","es","fr","it","ne","no","po","sw"};
this.lngNumber = 8;
this.fileArray = {null};
this.filename = null;
function onActionServerside() {
for (temp.i =0;i<8;++i){
filename.add("levels/translations/"@serverName@"_"@lngArray[i]@".po");
}
if ( params[0] == "loadfile" )
{
for ( temp.i=0; i<8;i++){
temp.lines = loadlines(filename[i]);
fileArray.add(temp.lines);
}
echo(fileArray[1]);
player.triggerclient("gui",this.name, "loaded", fileArray);
}
else if (params[0] == "save")
{
temp.rowId = params[2];
temp.file = filename[temp.rowId];
params[1].savelines(temp.file, 0);
player.triggerclient("gui",this.name, "saved");
}
else if (params[0] == "saveall")
{
fileArray = params[1];
echo(filename[j]);
//temp.savedata = new TStaticVar();
//temp.savedata.loadvarsfromarray(temp.data1);
for ( temp.j=0; j<8; ++j){
temp.data2 = this.fileArray[j];
temp.file = filename[j];
//echo(temp.file);
fileArray[j].savelines(temp.file, 0);
}
triggerclient("gui", this.name, "saved");
}
}
PHP Code:
//ACTIONS
function onTabSelect(){
trans.fileArray[prevTab] = EditTextML.getlines();
prevTab = Trans_Tabs.getselectedid();
output = trans.fileArray[prevTab];
EditTextML.setlines(output);
}
// FOR SEARCH FUNCTION TO WORK PERFECTLY EACH ENTRY MUST BE ON ONE LINE ONLY
function Search_Button.onAction(){
temp.toFind = Search_Field.gettext();
temp.data = EditTextML.getlines();
temp.numOfArray = temp.data.size();
temp.found = false;
this.foundx=0;
this.foundy=0;
for (temp.i = 0;i<temp.numOfArray +1; ++i){
temp.str = temp.data[i].tokenize();
temp.count = 0;
for (word : temp.str){
temp.count = temp.count+1;
if (temp.toFind == word){
this.foundx = count;
this.foundy = i;
temp.found = true;
player.chat = "found at"@count@","@i@"yea";
}
}
}
EditTextML_ScrollField.scrollto(0,(this.foundy*16)+10);
if (!temp.found){
player.chat = "Could not find Word";
}
}
function Save_Button.onAction(){
temp.saveStr = EditTextML.getlines();
rowid = Trans_Tabs.getselectedid();
trans.fileArray[rowId] = temp.saveStr;
EditTextML.setlines(trans.fileArray[rowId]);
triggerserver("gui", this.name, "save", temp.saveStr, rowid );
}
function SaveAll_Button.onAction(){
triggerserver("gui", this.name, "saveall", trans.fileArray);
}
function updateLines(){
triggerserver("gui", this.name, "update", rowId);
}
Its not letting me post the clientside GUI for whatever reason its say im restricted by the host server of the forums. so if you need that let me know.