Dynamic Achievements and Statistics Script (2.0) 
105 comments28.11.15 03:43:30 pm

3.12 mb, 1,396 Downloads










I did contributions such as Zombie Plague, Super Hero, Gun Game and CS2D Lighting & Shadows Engine.
After being absent for a while I'm glad to say that for the last time I'm sharing with you my last CS2D contribution.
- - ==== [






- - ==== [ Installation ] ==== - -
Downloaded ZIP archive includes GFX, SFX, SYS folders that must be overwritten in CS2D. In other words, you can simply extract it in CS2D folder.
- - ==== [ Script Features ] ==== - -







- - ==== [ Rank Feature ] ==== - -




- - ==== [ Configuration Feature ] ==== - -


- - ==== [ Graph Statistics Feature ] ==== - -




- - ==== [ Sample - How to Create Statistics for a Player ] ==== - -



Code:
1
AddStats("Kills", "gfx/stats/stat/stat_kills.png",stat_kills_Variable,stat_kills_Variable,true)



Code:
1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
--==== KILLS STATISTICS ====--
function stat_kills(killer,victim)
if (player(killer,"team") ~= player(victim,"team")) then
IncreaseUserValue(killer,"Kills",1)
end
end
function stat_kills_Variable(id)
return( GetUserValue(id,"Kills"))
end
AddValue("Kills")
AddFunction("kill",stat_kills)
function stat_kills(killer,victim)
if (player(killer,"team") ~= player(victim,"team")) then
IncreaseUserValue(killer,"Kills",1)
end
end
function stat_kills_Variable(id)
return( GetUserValue(id,"Kills"))
end
AddValue("Kills")
AddFunction("kill",stat_kills)
- - ==== [ Sample - How to Create Achievement ] ==== - -



Code:
1
AddAchievement("Body Bagger", GAMEMODE_ALL,"gfx/stats/a/body_bagger.jpg",{"Kill 25 enemies"},"BodyBagger",kill_BodyBaggerProcess)



Code:
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
-- ==== Body Bagger Achievement
function kill_BodyBagger(killer,victim)
if GetUserValue(killer,"Kills") > 24 then
OpenUnlockAchievement(killer,"BodyBagger")
end
end
function kill_BodyBaggerProcess(id)
return(GetUserValue(id,"Kills") / 25)
end
AddFunction("kill",kill_BodyBagger)
function kill_BodyBagger(killer,victim)
if GetUserValue(killer,"Kills") > 24 then
OpenUnlockAchievement(killer,"BodyBagger")
end
end
function kill_BodyBaggerProcess(id)
return(GetUserValue(id,"Kills") / 25)
end
AddFunction("kill",kill_BodyBagger)
- - ==== [ Sample - How to Create Server Statistics ] ==== - -



Code:
1
AddOverallStatistics("Overall Statistics",OvalDescription)



Code:
1
2
3
4
5
2
3
4
5
-- ==== Players Count Graph
function GraphPlayersCount()
SetGraphGlobalVariable("Players Played",#player(0,"table") )
end
AddGlobalFunction("second",GraphPlayersCount)
function GraphPlayersCount()
SetGraphGlobalVariable("Players Played",#player(0,"table") )
end
AddGlobalFunction("second",GraphPlayersCount)
- - ==== [ Player Achievements & Statistics Functions ] ==== - -
-- ==== [ Global Server Statistics Functions ] ==== - -
- - ==== [ Credits ] ==== - -



















edited 25×, last 24.09.19 06:42:38 pm

Comments
105 commentsLog in!
You need to log in to be able to write comments!Log in

@
SQ: dude, for some reason I get the same error as @
Hajt: , Download this version and try it in a new cs2d folder, you will get errors after 5 minutes, exactly the ones @
Hajt: mentioned. this version uses much less files in servertransfer.lst, I like it.
When you repair the code, delete this comment so that users do not get confused, thank you very much for the mod.



When you repair the code, delete this comment so that users do not get confused, thank you very much for the mod.
@
Grand Master: What useless things that makes lags?
You mean those additional security checks causes lags? Really?
@
Hajt: I have recently installed, it works fine.
There are no images that are missing.
I remember running this mod for weeks worked just fine.
I haven't changed it since then.

You mean those additional security checks causes lags? Really?
@

There are no images that are missing.
I remember running this mod for weeks worked just fine.
I haven't changed it since then.
edited 1×, last 24.09.19 07:04:33 pm

Check for bugs/miss spells, then upload it. I see a miss spell in file: user manager, function: GetUserValue.
Also I see there are many useless things, they make lags, nothing more.
Anyway I like it [6/10] ( - 1 for that miss spell, - 1 for that useless things what will make lags, nothing more )
Code:
ni or nil 1
2
3
4
5
6
2
3
4
5
6
function GetUserValue(id,value)
if (tonumber(id) ~= nil) then
if (id > 32) then
if (UserManager.data[id] == nil or UserManager.data[id].values[value] == ni) then
return(0)
end
if (tonumber(id) ~= nil) then
if (id > 32) then
if (UserManager.data[id] == nil or UserManager.data[id].values[value] == ni) then
return(0)
end
Code:
1
(UserManager.data[id] == nil or UserManager.data[id].values[value] == ni) then
Also I see there are many useless things, they make lags, nothing more.
Anyway I like it [6/10] ( - 1 for that miss spell, - 1 for that useless things what will make lags, nothing more )
@
Hajt: I guess you are loading old data file with new version of the script?


v2.0b
[06:38:08] ERROR: Can't add 'gfx/stats/a/Blitzkrieg.jpg' to transfer list: file does not exist!
[06:38:08] LUA ERROR: Cannot add 'achievementHook' to hook 'achievement' (hook does not exist)!
[16:54:56] LUA ERROR: 36964/lua/core/misc/filestream.lua:73: attempt to concatenate local 'str' (a boolean value)
[16:54:56] -> 36964/lua/core/misc/filestream.lua:73: in function 'WriteLine'
[16:54:56] -> 36964/lua/core/manager/manager_statistics.lua:164: in function 'statFunction'
[16:54:56] -> 36964/lua/core/misc/hooks.lua:255: in function 'shortcut'
[16:54:56] -> 36964/lua/core/misc/hooks.lua:206: in function <36964/lua/core/misc/hooks.lua:205>
[06:38:08] ERROR: Can't add 'gfx/stats/a/Blitzkrieg.jpg' to transfer list: file does not exist!
[06:38:08] LUA ERROR: Cannot add 'achievementHook' to hook 'achievement' (hook does not exist)!
[16:54:56] LUA ERROR: 36964/lua/core/misc/filestream.lua:73: attempt to concatenate local 'str' (a boolean value)
[16:54:56] -> 36964/lua/core/misc/filestream.lua:73: in function 'WriteLine'
[16:54:56] -> 36964/lua/core/manager/manager_statistics.lua:164: in function 'statFunction'
[16:54:56] -> 36964/lua/core/misc/hooks.lua:255: in function 'shortcut'
[16:54:56] -> 36964/lua/core/misc/hooks.lua:206: in function <36964/lua/core/misc/hooks.lua:205>
edited 1×, last 05.12.18 11:52:26 pm

One thing Is Broken, whenever I Load Any map In CS2D While having This Mod Installed, The Game stops Responding, Happens on Every Map.

so many credits to those who tried the mod and even so it is defective. fix this to put it online.

NOOO I just optimized this script for my Call of Duty server and now I gotta do it all over again
Btw this is the greatest lua script ever written for CS2D.
Btw this is the greatest lua script ever written for CS2D.