Comments (5)
I can't really go too in-depth, but are you sure that all the other clients actually 'know' the user bought it and execute the code? I imagine the server should check the buy status, then set a networked variable on the SWEP or something to synchronize the state between all clients.
from swep_construction_kit.
I tested a few things with the networked variables but couldn't really get it to work. I'll take another stab at it and see what I can get. I think I see what you're getting at here, and I hadn't really thought of that. Let me give it a go and get back to you.
from swep_construction_kit.
Still no dice. It works the same as before. Here's what I have now:
function SWEP:Think()
if SERVER then
local Melee = //snip
if Melee == nil then
self:SetNWString("Type", "Yellow")
else
if Melee == "Red Lightsaber" then
self:SetNWString("Type", "Red")
elseif Melee == "Blue Lightsaber" then
self:SetNWString("Type", "Blue")
elseif Melee == "Green Lightsaber" then
self:SetNWString("Type", "Green")
elseif Melee == "Purple Lightsaber" then
self:SetNWString("Type", "Purple")
end
end
end
local Type = self:GetNWString("Type")
if Type == nil or Type == "Yellow" then
self.VElements["SaberY"].skin = 5
self.WElements["SaberY"].skin = 5
else
if Type == "Red" then
self.VElements["SaberY"].skin = 4
self.WElements["SaberY"].skin = 4
elseif Type == "Blue" then
self.VElements["SaberY"].skin = 0
self.WElements["SaberY"].skin = 0
elseif Type == "Green" then
self.VElements["SaberY"].skin = 1
self.WElements["SaberY"].skin = 1
elseif Type == "Purple" then
self.VElements["SaberY"].skin = 3
self.WElements["SaberY"] = 3
end
end
end
Once again with that same bit of code snipped out. I'm not massively experienced in LUA coding, and NW variables are not something I've used before. Still, it's functioning properly on the client side of things as before, so I assume I did it correctly.
EDIT: Using a pre-set variable I was able to determine that pointshop 2 doesn't seem to be causing this issue. I simply set a variable to blue and then set the weapon code to change all the lightsaber colors to blue if that variable was equal to blue, and I got the same result as before. All the lightsabers appeared blue to the people holding them, and yellow (default) to everyone else.
from swep_construction_kit.
Check if the model:SetSkin function in the SWEP:DrawWorldModel part of the base code is actually called on those other clients. Work back from there.
from swep_construction_kit.
I'm not really sure if I'm testing this right, but it does seem to be calling on the other clients and I'm not really sure where to go from there.
I don't really want to keep bothering you with this, it's definitely starting to seem as though my LUA skills simply aren't up to the task. I don't suppose you maybe have an example weapon laying around I could look at as a last ditch effort?
EDIT: Oh, something I forgot to mention, I CAN change it completely successfully but only if I do so in the initial variable setup for the weapon. So
SWEP.WElements = {
["SaberY"] = { type = "Model", model = "models/sgg/starwars/weapons/w_saber_4.mdl", bone = "ValveBiped.Bip01_R_Hand", rel = "", pos = Vector(3.5, 0.5, -6), angle = Angle(80.649, -153.118, 180), size = Vector(1, 1, 1), color = Color(255, 255, 255, 255), surpresslightning = false, material = "", skin = 5, bodygroup = {} }
}
SWEP.WElements["SaberY"].skin = 0
The above code works successfully, and properly changes the skin for all players. However, this doesn't help because I can't get self.Owner from this point. It's not until I start trying to put this code inside a function, like Think() that it ceases to work properly.
from swep_construction_kit.
Related Issues (6)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swep_construction_kit.