• PlayerInitialSpawn to change map textures
    2 replies, posted
Hello! Im trying to make a lua script to change the map textures. The good thing that it works, but it only works after saving it while on the server. It doesnt run on PlayerInitialSpawn. I have asked around for help by a few coder friends i know, but they havent been to much help. Right now this is what i have: AddCSLuaFile() hook.Add("PlayerInitialSpawn","PlyJoin",function(met) local mat = Material"ocrp/rfstamp1" local met = Material"oslorp/oslo" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/taco1" local met = Material"oslorp/max1" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/boa1" local met = Material"oslorp/dnb1" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/boa2" local met = Material"oslorp/dnb2" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/bh1" local met = Material"oslorp/naf" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/cobsgm1" local met = Material"oslorp/bilforhandler1" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/cobsgm2" local met = Material"oslorp/bilforhandler2" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/gm01" local met = Material"oslorp/bilforhandler3" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/foods1" local met = Material"oslorp/rema1000" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/frosty1" local met = Material"oslorp/cubus" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/grace1" local met = Material"oslorp/uio" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/quarantine1" local met = Material"oslorp/eiendomsmegler1" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/rfems1" local met = Material"oslorp/ambu" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/rffd1" local met = Material"oslorp/brannvesenet" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/rfpd1" local met = Material"oslorp/politiet1" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/rfpd2" local met = Material"oslorp/politilogo" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") local mat = Material"ocrp/transit1" local met = Material"oslorp/oslotaxi" mat:SetTexture("$basetexture", met:GetTexture"$basetexture") end) Note that the lua file is in lua/autorun/client
GM/PlayerInitialSpawn is a serverside hook. Try using GM/InitPostEntity instead
Also, there's a category for Garry's Mod specific coding. My bad! Didn't see it! Ill try InitPostEntity and check if that works
Sorry, you need to Log In to post a reply to this thread.