1. Sign up for news, events and more!

    You're currently visiting the official DarkRP Forums as a guest. Sign up now to participate in our community and we'll let you know when we have news.

Release Classic Advert

Discussion in 'DarkRP Addon & Plugin Releases' started by Fillipuster, Jun 23, 2016.

  1. Fillipuster

    Fillipuster Member

    The newest version of DarkRP replaced the old advert system with a new billboard system.
    Some people have requested the old system back, so here it is.

    Simply extract the "fp_classicadvert" in to your "addons/darkrpmodification/lua/darkrp_modules" folder, and you're good to go.

    The new advert command is "/ad", but this can be changed in "sh_config.lua", as well as a bunch of other stuff.

    If you want to be able to charge money for advert, let me know so I can implement that.

    D̶o̶w̶n̶l̶o̶a̶d̶ ̶(̶v̶1̶.̶0̶)̶
    Download (v1.1)
     

    Attached Files:

    Last edited: Jun 25, 2016
  2. cj2tech

    cj2tech Member

    i told him to do it lol
     
    MY MAN LU WAYN DAWAYN likes this.
  3. Thanks! It was a matter of time till this returned
     
  4. [TAL] Dragon

    [TAL] Dragon New Member

    My players cannot see their and my adverts.
     
  5. Is there any way to make the complete opposite of this? Like /ad makes a billboard and /advert does the chat.
     
  6. Matryan

    Matryan Well-Known Member

    Get rid of the #NoSimplerr#, it should really only be used whilst debugging and developing - If there's an error in your code people want to know what it is and how to fix it easily.
    Also, instead of using
    Code (Lua):
    ply:SendLua( string.format( [[notification.AddLegacy( "%s", 1, 5 )
                surface.PlaySound( "buttons/button15.wav" )]]
    , CLASSICADVERT.failMessage ) )
    why not use the DarkRP's notify?
     
  7. Fillipuster

    Fillipuster Member

    I forgot about #NoSimplerr#, sorry.

    I didn't know of DarkRP's notify, I might use that.

    Also:

    The people who cannot see the adverts globally, are you getting any errors?
     
    Wizard Wandz likes this.
  8. Wizard Wandz

    Wizard Wandz New Member

    It ends up looking like this and everyone cannot see it in the global chat.
    --- Double Post Merged, Jun 24, 2016 ---
    I am also not seeing any errors in the console.
     

    Attached Files:

    Last edited: Jun 24, 2016
  9. Noodles

    Noodles New Member

    Same problem players can not see adverts
     
    Wizard Wandz likes this.
  10. Matryan

    Matryan Well-Known Member

    There wouldn't be any errors.
    Have a read over your code - specifically, read over your loop.
     
  11. Fillipuster

    Fillipuster Member

    Ah, I see. Huge derp. I'll go slap myself a few times in the nuts. Thanks Matryan.

    For everyone else. Download the new version (1.1) for the fix.

    - Oh, and also: I forgot to remove the #NoSimplerr# in the sv_advert.lua file. If you are experiencing problems, please remove the first line of the sv_advert.lua file. If a new version is ever released, then I will be sure to remove it.
     
    Last edited: Jun 25, 2016
  12. Wizard Wandz

    Wizard Wandz New Member

    It's Still now showing up globally even though i downloaded the new one
     
  13. Matryan

    Matryan Well-Known Member

    In your case, having 'return ""' there doesn't do anything, you can remove it.
    Not sure what would be causing there error above, though.
     
  14. Fillipuster

    Fillipuster Member

    I believe the return is to prevent a regular chat message from being displayed.
    Haven't tried without.
     
  15. PhoNoTheSky

    PhoNoTheSky New Member

    i think i have a fix but im not sure because i have not friends that want to test on my server
    Code (Text):
    function playerAdvert( ply, args )

        if args == "" then

            ply:SendLua( string.format( [[notification.AddLegacy( "%s", 1, 5 )
                surface.PlaySound( "buttons/button15.wav" )]], CLASSICADVERT.failMessage ) )

        else

            for k,pl in pairs( player.GetAll() ) do

                --local senderColor = team.GetColor( ply:Team() )
                --DarkRP.talkToPerson( pl, senderColor, CLASSICADVERT.chatPrefix.." "..ply:Nick(), CLASSICADVERT.advertTextColor, args, ply )
                DarkRP.talkToRange(pl, CLASSICADVERT.chatPrefix.." "..ply:Nick(), args, 1000)

            end

            return ""

        end

    end
    DarkRP.defineChatCommand( CLASSICADVERT.chatCommand, playerAdvert )
    i replaced talkToPerson with talkToRange but with talkToRange im not sure how to change colour
    --- Double Post Merged, Jun 29, 2016 ---
    also this is the talkToRange source
    Code (Text):
    function DarkRP.talkToRange(ply, PlayerName, Message, size)
        local ents = ents.FindInSphere(ply:EyePos(), size)
        local col = team.GetColor(ply:Team())
        local filter = {}

        for k, v in pairs(ents) do
            if v:IsPlayer() then
                table.insert(filter, v)
            end
        end

        if PlayerName == ply:Nick() then PlayerName = "" end -- If it's just normal chat, why not cut down on networking and get the name on the client

        net.Start("DarkRP_Chat")
            net.WriteUInt(col.r, 8)
            net.WriteUInt(col.g, 8)
            net.WriteUInt(col.b, 8)
            net.WriteString(PlayerName)
            net.WriteEntity(ply)
            net.WriteUInt(255, 8)
            net.WriteUInt(255, 8)
            net.WriteUInt(255, 8)
            net.WriteString(Message)
        net.Send(filter)
    end
     
    --- Double Post Merged, Jun 29, 2016 ---
    the sendercolour in your original code is not used anymore because it is already in the talkToRange code
     
    Last edited: Jun 29, 2016
  16. Temp

    Temp New Member

    Error I get..

    [ERROR] gamemodes/starwarsrp/entities/entities/darkrp_billboard/init.lua:47: attempt to compare nil with number
    1. callback - gamemodes/starwarsrp/entities/entities/darkrp_billboard/init.lua:47
    2. callback - gamemodes/starwarsrp/gamemode/modules/chat/sv_chat.lua:17
    3. RP_PlayerChat - gamemodes/starwarsrp/gamemode/modules/chat/sv_chat.lua:78
    4. unknown - gamemodes/starwarsrp/gamemode/modules/chat/sv_chat.lua:142
     
  17. HH11

    HH11 New Member

    Hey bro this doesn't work :p
     
  18. Noodles

    Noodles New Member

    This works great job man probably the best simple free script :)
     
  19. SlenderDaddy

    SlenderDaddy Member

    How do i remove the billboard so i have /advert
     
  20. Noodles

    Noodles New Member

Share This Page