From: Mircea Kitsune Date: Sun, 30 Oct 2011 09:46:21 +0000 (+0200) Subject: Update object owner nickname when using the object_claim command. This can also be... X-Git-Tag: xonotic-v0.6.0~35^2~18^2~29 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=94b372e39fc77ef0c30833610d0b17105c309955;p=xonotic%2Fxonotic-data.pk3dir.git Update object owner nickname when using the object_claim command. This can also be used to update your name on an object if you already own it, but changed your nickname since creating it. --- diff --git a/qcsrc/server/mutators/sandbox.qc b/qcsrc/server/mutators/sandbox.qc index 263e67aa0..88cd813ae 100644 --- a/qcsrc/server/mutators/sandbox.qc +++ b/qcsrc/server/mutators/sandbox.qc @@ -593,8 +593,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) e.damageforcescale = stof(argv(3)); break; case "material": - if(e.material) - strunzone(e.material); + if(e.material) strunzone(e.material); if(argv(3)) { for (i = 1; i <= 5; i++) // precache material sounds, 5 in total @@ -610,8 +609,7 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) } // update last edit time - if(e.message2) - strunzone(e.message2); + if(e.message2) strunzone(e.message2); e.message2 = strftime(TRUE, "%d-%m-%Y %H:%M:%S"); if(autocvar_g_sandbox_info > 1) @@ -633,15 +631,21 @@ MUTATOR_HOOKFUNCTION(sandbox_PlayerCommand) e = sandbox_ObjectEdit_Get(TRUE); if(e != world) { + // update the owner's name + // Do this before checking if you're already the owner and skipping if such, so we + // also update the nickname if the player changed it (and has the same player UID) + if(e.netname) strunzone(e.netname); + e.netname = strftime(TRUE, "%d-%m-%Y %H:%M:%S"); + if(e.crypto_idfp == self.crypto_idfp) { print_to(self, "^2SANDBOX - INFO: ^7Object is already yours, nothing to claim"); return TRUE; } - if(e.crypto_idfp) - strunzone(e.crypto_idfp); + if(e.crypto_idfp) strunzone(e.crypto_idfp); e.crypto_idfp = self.crypto_idfp; + print_to(self, "^2SANDBOX - INFO: ^7Object claimed successfully"); } print_to(self, "^1SANDBOX - WARNING: ^7Object could not be claimed. Make sure you are facing an object that you have edit rights over");