[Source 2] Vscript chat advertisements (Help needed)

sexgamer

Добрая душа
Сообщения
82
Реакции
69
All the credit for the code goes to NeXi#2000 I'm asking for help on his behalf.

chatNotifyComp.lua:
print("Start Competitive Chat Print Script")
thisEntity:SetThink(function()

    example = function (x)
        local r = math.random(1, 5) --Change the last number if you want to have more then 12 messages in your list
        --print("Got Message Number:", r)
        return x[r]
    end

    --Here you setup your messages you want to display
    --If you want to make a "Line Seperator", use this symbol in the bracket here -> [ 
 ]

    --Here are the color codes if you want to make colored messages

    --     --White
    --     --Red
    --     --Light Red
    --     --Light Blue
    --     --Dark Blue
    --     --Pink
    --     --Gold
    --     --Light Green
    --     --Lime
    --     --Green
    --     --Grey
    --     --Pale Red

    exampleArray = {
        " OOF.LV - You are playing on OOF.LV 8vs8 Competitive!
The Server IP is CS2.OOF.LV and the is server located in Latvia, Europe :)",
        " OOF.LV - WARNING! The server might suddenly crash because CS2 Beta is unstable. The server will auto-reboot on crash",
        " OOF.LV - Is your ping too high? 
OOF.LV - You can find other servers on our website OOF.LV in the Counter-Strike 2 section!",
        " OOF.LV - Need help or want to follow game updates? 
OOF.LV - Go on our Discord server ♥: oof.lv/discord",
        " OOF.LV - If you are running on the cracked version, you can enable the inventory & change default weapons by opening CS:GO first and then CS2",
    }

    --Say( logic_script, example(exampleArray), false
    ScriptPrintMessageChatAll( example(exampleArray) )

    return 30 -- Setup here the time interval of the messages
end)

chatNotifyScriptComp.lua:
local logicScripts = Entities:FindAllByClassname("logic_script")
for k,v in pairs(logicScripts) do
    UTIL_Remove(v)
end
local script = SpawnEntityFromTableSynchronous("logic_script",{
    vscripts = "chatNotifyComp"
})


We have been at the dead end displaying chat ads because basically what happens though is that every Script that is not from the map gets stopped and deleted when the next round loads. Maybe anyone has a solution to how to fix this?
 

Palonez

бб братки
Сообщения
3,035
Реакции
1,837
All the credit for the code goes to NeXi#2000 I'm asking for help on his behalf.

chatNotifyComp.lua:
print("Start Competitive Chat Print Script")
thisEntity:SetThink(function()

    example = function (x)
        local r = math.random(1, 5) --Change the last number if you want to have more then 12 messages in your list
        --print("Got Message Number:", r)
        return x[r]
    end

    --Here you setup your messages you want to display
    --If you want to make a "Line Seperator", use this symbol in the bracket here -> [ 
 ]

    --Here are the color codes if you want to make colored messages

    --     --White
    --     --Red
    --     --Light Red
    --     --Light Blue
    --     --Dark Blue
    --     --Pink
    --     --Gold
    --     --Light Green
    --     --Lime
    --     --Green
    --     --Grey
    --     --Pale Red

    exampleArray = {
        " OOF.LV - You are playing on OOF.LV 8vs8 Competitive!
The Server IP is CS2.OOF.LV and the is server located in Latvia, Europe :)",
        " OOF.LV - WARNING! The server might suddenly crash because CS2 Beta is unstable. The server will auto-reboot on crash",
        " OOF.LV - Is your ping too high? 
OOF.LV - You can find other servers on our website OOF.LV in the Counter-Strike 2 section!",
        " OOF.LV - Need help or want to follow game updates? 
OOF.LV - Go on our Discord server ♥: oof.lv/discord",
        " OOF.LV - If you are running on the cracked version, you can enable the inventory & change default weapons by opening CS:GO first and then CS2",
    }

    --Say( logic_script, example(exampleArray), false
    ScriptPrintMessageChatAll( example(exampleArray) )

    return 30 -- Setup here the time interval of the messages
end)

chatNotifyScriptComp.lua:
local logicScripts = Entities:FindAllByClassname("logic_script")
for k,v in pairs(logicScripts) do
    UTIL_Remove(v)
end
local script = SpawnEntityFromTableSynchronous("logic_script",{
    vscripts = "chatNotifyComp"
})


We have been at the dead end displaying chat ads because basically what happens though is that every Script that is not from the map gets stopped and deleted when the next round loads. Maybe anyone has a solution to how to fix this?
You can try to listen game_newmap event which will reload script again uses SendToServerConsole("script_reload_code chatNotifyScriptComp")
 
Последнее редактирование:
Сверху Снизу