Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- this file: \steamapps\common\dota 2 beta\game\dota\scripts\vscripts\core\coreinit.lua
- -- Dota show behavior on startup and after match by AveYo v8 with dynamic grade color [set it and forget it]
- -- v9 final : Reliable, native VScript scheduler!
- local ToConsole = function(s) if SendToServerConsole then SendToServerConsole(s) else SendToConsole(s) end end
- local HideBehaviorScore = function(t) ToConsole( 'top_bar_message "" ' .. t ) Convars:SetStr('cl_class','default') end
- local ShowBehaviorScore = function(t)
- local behavior_score = Convars:GetStr( 'cl_class' ):gsub('\n','') -- import i/o cvar cl_class
- local grade = behavior_score:gsub('behavior_score: ',''):gsub('+',''):gsub('-','') -- substring grade
- local flower = { Normal=true, A=true, B=true, C=true } -- Roses are Red, Violetes are Blue
- local ass = 1 -- set flag to use red message by default
- if flower[grade] then ass = 0 end -- set flag to use blue message if behavior_score is flower grade
- print( behavior_score ) -- print behavior_score into Console
- local VScheduler = EntIndexToHScript(0) -- if there are entities loaded, than vscheduler is available
- if VScheduler then
- ToConsole( 'top_bar_message "' .. behavior_score .. '" ' .. ass .. ';' ) -- show top bar gui message
- VScheduler:SetContextThink( "GabenPlz", function() HideBehaviorScore(ass) end, 4 ) -- hide after 4 seconds
- end
- end
- if SendToServerConsole then -- local client only [ VScripts loads two vm's, one for sv, one for cl ]
- ToConsole( 'developer 1; dota_game_account_client_debug | cl_class; developer 0;' ) -- save score into cl_class
- ListenToGameEvent("player_connect_full", ShowBehaviorScore, nil) -- show message after each new map
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement