@@ -257,7 +257,7 @@ minetest.register_chatcommand("top50", {
257
257
})
258
258
259
259
minetest .register_chatcommand (" make_pro" , {
260
- description = " Make yourself or another player a pro" ,
260
+ description = " Make yourself or another player a pro (Will break target player's ranks) " ,
261
261
params = " [mode:technical modename] <playername>" ,
262
262
privs = {ctf_admin = true },
263
263
func = function (name , param )
@@ -271,16 +271,17 @@ minetest.register_chatcommand("make_pro", {
271
271
end
272
272
273
273
local old_ranks = mode_data .rankings :get (pname )
274
+ local note = " "
274
275
if not old_ranks then
275
- return false , string.format (" Player '%s' has no rankings! " , pname )
276
+ note = string.format (" Note: Player '%s' had no rankings before that. " , pname )
276
277
end
277
278
278
- mode_data .rankings :add (pname , {score = 8000 , kills = 7 , deaths = 5 , flag_captures = 5 })
279
+ mode_data .rankings :set (pname , {score = 8000 , kills = 7 , deaths = 5 , flag_captures = 5 })
279
280
280
281
minetest .log (" action" , string.format (
281
282
" [ctf_admin] %s made player '%s' a pro in mode %s: %s" , name , pname , mode_name , dump (old_ranks )
282
283
))
283
- return true , string.format (" Player '%s' is now a pro! " , pname )
284
+ return true , string.format (" Player '%s' is now a pro.%s " , pname , note )
284
285
end
285
286
})
286
287
@@ -306,17 +307,17 @@ minetest.register_chatcommand("add_score", {
306
307
end
307
308
308
309
local old_ranks = mode_data .rankings :get (pname )
310
+ local note = " "
309
311
if not old_ranks then
310
- return false , string.format (" Player '%s' has no rankings! " , pname )
312
+ note = string.format (" Note: Player '%s' had no rankings before that. " , pname )
311
313
end
312
314
313
- local old_score = old_ranks .score or 0
314
- mode_data .rankings :set (pname , {score = old_score + score })
315
+ mode_data .rankings :add (pname , {score = score })
315
316
316
317
minetest .log (" action" , string.format (
317
318
" [ctf_admin] %s added %s score to player '%s' in mode %s" , name , score , pname , mode_name
318
319
))
319
- return true , string.format (" Added %s score to player '%s'" , score , pname )
320
+ return true , string.format (" Added %s score to player '%s'.%s " , score , pname , note )
320
321
end
321
322
})
322
323
@@ -353,29 +354,30 @@ minetest.register_chatcommand("transfer_rankings", {
353
354
end
354
355
end
355
356
357
+ local note = " "
356
358
if not src_exists then
357
359
return false , string.format (" Source player '%s' has no rankings!" , src )
358
360
end
359
361
if not dst_exists then
360
- return false , string.format (" Destination player '%s' has no rankings! " , dst )
362
+ note = string.format (" Note: Destination player '%s' had no rankings. " , dst )
361
363
end
362
364
363
365
if src == dst then
364
366
return false , " Source name and destination name cannot be the same!"
365
367
end
366
368
367
369
for mode_name , mode in pairs (ctf_modebase .modes ) do
368
- mode .rankings :add (dst , src_rankings [mode_name ])
370
+ mode .rankings :set (dst , src_rankings [mode_name ], true )
369
371
end
370
372
371
373
for _ , mode in pairs (ctf_modebase .modes ) do
372
374
mode .rankings :set (src , {}, true )
373
375
end
374
376
375
377
minetest .log (" action" , string.format (
376
- " [ctf_admin] %s transferred rankings from '%s' to '%s': %s -> %s" ,
377
- name , src , dst , dump (src_rankings ), dump (dst_rankings )
378
+ " [ctf_admin] %s transferred rankings from '%s' to '%s': %s -> %s | %s " ,
379
+ name , src , dst , dump (src_rankings ), dump (dst_rankings ), note
378
380
))
379
- return true , string.format (" Rankings of '%s' have been transferred to '%s'" , src , dst )
381
+ return true , string.format (" Rankings of '%s' have been transferred to '%s'.%s " , src , dst , note )
380
382
end
381
383
})
0 commit comments