Index: LFSClient/GLSPlayerVars.cs =================================================================== --- LFSClient/GLSPlayerVars.cs (revision 43) +++ LFSClient/GLSPlayerVars.cs (working copy) @@ -137,7 +137,8 @@ ShowSplitPb, // Does the split PB iare showed 1 = Yes, 0 = No UnitSpeedKmh, // What's unit is used for speed and distance 1 = km 0 = miles IdLang, // Id of the player lang - + UCID, + PLID, } public void SetVarPlayer(GLScript.unionVal val, string idVar, string userName, string value) @@ -743,7 +744,7 @@ val.typVal = GLScript.typVal.num; // if (currInfoPlayer.finishedPos != -1) // { - val.fval = (float)currInfoPlayer.finishedPos + 1; + val.fval = (float)currInfoPlayer.finishedPos; // } break; case "racetotaltime": @@ -792,6 +793,14 @@ else val.fval = 0; break; + case "ucid": + val.typVal = GLScript.typVal.num; + val.fval = (float)currInfoPlayer.UCID; + break; + case "plid": + val.typVal = GLScript.typVal.num; + val.fval = (float)currInfoPlayer.PLID; + break; case "unitspeedkmh": val.typVal = GLScript.typVal.num; if( currInfoPlayer.unitSpeedKmh ) @@ -801,7 +810,7 @@ break; case "idlang": val.typVal = GLScript.typVal.str; - val.sval = utils.quote(currInfoPlayer.idLang); ; + val.sval = utils.quote(currInfoPlayer.idLang); break; default: // Normally, go never here GLScript.unionVal retVal = currInfoPlayer.playerVars.Get(idVar); Index: LFSClient/lfsclient.cs =================================================================== --- LFSClient/lfsclient.cs (revision 43) +++ LFSClient/lfsclient.cs (working copy) @@ -83,6 +83,7 @@ public int raceLapsLeft = 0; public int qualMins = 0; public int raceMins = 0; + public int raceFlags = 0; } raceInfo currRace = new raceInfo(); Index: LFSClient/managePacket.cs =================================================================== --- LFSClient/managePacket.cs (revision 43) +++ LFSClient/managePacket.cs (working copy) @@ -76,6 +76,13 @@ else currInfoPlayer.allowIdleOnTrack = false; + // Set the admin flag if the player is a server admin + if (newConnection.Admin == 1) + { + currInfoPlayer.isServerAdmin = true; + uGroup.addUser("superUsers", currInfoPlayer.userName); + } + string[] args = new string[1]; args[0] = currInfoPlayer.userName; newCfg.executeFunction("OnConnect", currInfoPlayer, args); @@ -584,6 +591,7 @@ listOfPlayers.raceRestart(); string[] par = new string[1]; + currRace.raceFlags = rst.Flags; currRace.raceLaps = 0; currRace.raceMins = 0; currRace.qualMins = 0; @@ -649,7 +657,7 @@ if (currInfoPlayer == null) return; - currInfoPlayer.finishedPos = res.ResultNum; + currInfoPlayer.finishedPos = res.ResultNum + 1; currInfoPlayer.racePBTime = res.BTime; currInfoPlayer.raceTotalTime = res.TTime; string [] par = new string[2]; Index: LFSClient/scriptFunctions.cs =================================================================== --- LFSClient/scriptFunctions.cs (revision 43) +++ LFSClient/scriptFunctions.cs (working copy) @@ -73,6 +73,8 @@ newCfg.CurrApp.registerCallBackFunction("getlistofplayers", getlistofplayers); newCfg.CurrApp.registerCallBackFunction("setplayervar", setplayervar); newCfg.CurrApp.registerCallBackFunction("getplayervar", getplayervar); + newCfg.CurrApp.registerCallBackFunction("getplayervarbyucid", getplayervarbyucid); + newCfg.CurrApp.registerCallBackFunction("getplayervarbyplid", getplayervarbyplid); newCfg.CurrApp.registerCallBackFunction("getlappervar", getlappervar); newCfg.CurrApp.registerCallBackFunction("getconfigvar", getconfigvar); newCfg.CurrApp.registerCallBackFunction("setconfigvar", setconfigvar); @@ -141,6 +143,7 @@ newCfg.CurrApp.registerCallBackFunction("removeuserfromgroup", removeuserfromgroup); newCfg.CurrApp.registerCallBackFunction("cleargroup", cleargroup); newCfg.CurrApp.registerCallBackFunction("userisadmin", userisadmin); + newCfg.CurrApp.registerCallBackFunction("userisserveradmin", userisserveradmin); newCfg.CurrApp.registerCallBackFunction("useringroup", useringroup); newCfg.CurrApp.registerCallBackFunction("getusergrippb", getusergrippb); newCfg.CurrApp.registerCallBackFunction("getuserdriftpb", getuserdriftpb); @@ -336,6 +339,15 @@ val.typVal = GLScript.typVal.num; val.fval = currState.NumP; return; + case "mustpit": + val.typVal = GLScript.typVal.num; +// val.fval = InSim.Decoder.RST.Flags & 64; +// val.fval = currRace.raceFlags & 64; + if ((currRace.raceFlags & 64) == 64) + val.fval = 1; + else + val.fval = 0; + return; default: val.typVal = GLScript.typVal.str; val.sval = utils.quote(""); @@ -548,6 +560,40 @@ val.sval = retVal.sval; val.fval = retVal.fval; } + public void getplayervarbyucid(GLScript.unionVal val, ArrayList args) + { + string ident = val.nameFunction; + testArgs(ident, "IS", args); + + infoPlayer currInfoPlayer = listOfPlayers.getPlayerByUCID(int.Parse(args[0].ToString())); + if (currInfoPlayer == null) + { + val.typVal = GLScript.typVal.str; + val.sval = utils.quote(""); + return; + } + GLScript.unionVal retVal = currInfoPlayer.playerVars.Get(utils.quote((string)args[1])); + val.typVal = retVal.typVal; + val.sval = retVal.sval; + val.fval = retVal.fval; + } + public void getplayervarbyplid(GLScript.unionVal val, ArrayList args) + { + string ident = val.nameFunction; + testArgs(ident, "IS", args); + + infoPlayer currInfoPlayer = listOfPlayers.getPlayerByPLID(int.Parse(args[0].ToString())); + if (currInfoPlayer == null) + { + val.typVal = GLScript.typVal.str; + val.sval = utils.quote(""); + return; + } + GLScript.unionVal retVal = currInfoPlayer.playerVars.Get(utils.quote((string)args[1])); + val.typVal = retVal.typVal; + val.sval = retVal.sval; + val.fval = retVal.fval; + } public void getlappervar(GLScript.unionVal val, ArrayList args) { string ident = val.nameFunction; @@ -1308,6 +1354,17 @@ testArgs(ident, "S", args); uGroup.clear(args[0].ToString()); } + public void userisserveradmin(GLScript.unionVal val, ArrayList args) + { + infoPlayer currInfoPlayer = newCfg.getCurrInfoPlayer(); + string ident = val.nameFunction; + testArgs(ident, "S", args); + val.typVal = GLScript.typVal.num; + if (currInfoPlayer.isServerAdmin == true) + val.fval = 1; + else + val.fval = 0; + } public void userisadmin(GLScript.unionVal val, ArrayList args) { infoPlayer currInfoPlayer = newCfg.getCurrInfoPlayer(); @@ -1316,7 +1373,7 @@ val.typVal = GLScript.typVal.num; uGroup.clear( "admin"); uGroup.addUserFromFile("admin",newCfg.varsLapper.WorkingDir + "/" + newCfg.varsLapper.AdminFile ); - if (uGroup.userExist("admin", args[0].ToString()) || currInfoPlayer.UCID == 0) + if (uGroup.userExist("admin", args[0].ToString()) || currInfoPlayer.UCID == 0 || currInfoPlayer.isServerAdmin == true) val.fval = 1; else val.fval = 0; Index: LFSInstances/LapperInstance.cs =================================================================== --- LFSInstances/LapperInstance.cs (revision 43) +++ LFSInstances/LapperInstance.cs (working copy) @@ -200,7 +200,7 @@ else if (mso.message.ToLower() == "!start") { ugroup.addUserFromFile("superUsers", infos.workingDir + "/" + infos.superUsers); - if (listOfPlayers.ContainsKey(mso.UCID) && ugroup.userExist("superUsers", (string)listOfPlayers[mso.UCID])){ + if ((listOfPlayers.ContainsKey(mso.UCID) && ugroup.userExist("superUsers", (string)listOfPlayers[mso.UCID])) || (mso.UCID == 0 )){ infos.autoStart = LapperInstances.infoInstance.autoStartVal.AUTO_WORK; } else Index: Players/infoPlayer.cs =================================================================== --- Players/infoPlayer.cs (revision 43) +++ Players/infoPlayer.cs (working copy) @@ -42,6 +42,7 @@ private InSim.Connect IC; public string userName; public string nickName; + public bool isServerAdmin = false; // Is the player a server admin public string idLang = "en"; Index: Players/ListPlayers.cs =================================================================== --- Players/ListPlayers.cs (revision 43) +++ Players/ListPlayers.cs (working copy) @@ -313,7 +313,7 @@ currInfoPlayer.currSplit = 0; currInfoPlayer.currVote = (int)InSim.vtn.VOTE_NONE; currInfoPlayer.drivethroughcount = 0; - currInfoPlayer.finishedPos = 0; + currInfoPlayer.finishedPos = -1; currInfoPlayer.lapTime = 0; currInfoPlayer.lastSplitTime = -1; currInfoPlayer.maxLapSpeed = 0;