Need help with resource file

I want to create a file that will download this:

but only if css is not mounted. Not sure if this is possible but if someone can point me in the right direction that would be awesome!

Not possible since IsMounted is done clientside and resource.AddWorkshop/File is serverside. Not to mention that you really shouldn’t be sending content packs to clients, and they may already have a content pack.

Is there an easy way to just have a message pop up saying they need to mount css or just “CSS Content is required to view Textures & Models properly”?


if ( IsMounted( 'cstrike' ) == false ) then
    ply:ChatPrint( "Buy CSS fucking pleb" )
end

Code needs to be run clientside. You could use file.Exists to find out if the client has a content pack, although that would be unreliable.

Sorry I’m kind of a noob with lua, where would I put this?

lua/autorun/client

thanks!

Getting an error "attempt to index global ‘ply’ (a nil value)

  1. unknown - lua/autorun/client/missing.lua

I’m dumb. Replace ply with Player

Tried with a Player, didnt like that so i switched to player. now it says:
attempt to call method ‘ChatPrint’ (a nil value)
line 2 again

from some looking up would you need to use something like:
PrintMessage(HUD_PRINTTALK, “I’m new here.”)

[editline]10th March 2014[/editline]

Going to see if this would work:



if ( IsMounted( 'cstrike' ) == false ) then
	player.GetByID( 1 ):PrintMessage( HUD_PRINTTALK, "You are missing Counter Strike: Source which is needed to play!" )
end

[editline]10th March 2014[/editline]

Yea I don’t think this is working :confused:

I’m dumb and forgot how IsMounted worked. This should definitely work and has been tested:


local function spawn( ply )
	if ( IsMounted( 'cstrike' ) == false ) then
             ply:ChatPrint( "Buy CSS fucking pleb" )
        end
end
hook.Add( "PlayerInitialSpawn", "Content_Checker", spawn )


Sorry about all the trouble.

All good, I appreciate the help though and will be trying this now :slight_smile: