Team Spartan Cookies & Milk Forums
  • Issue Tracker
  • Donations
  • Search
  • Member List
  • Help

Register

Team Spartan Cookies & Milk Forums Garry's Mod Starfall v
« Previous 1 … 10 11 12 13 14 … 18 Next »
globaltables doesn't keep data between sf instances...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Linear Mode
globaltables doesn't keep data between sf instances...
05-11-2015, 06:56 PM,
#6
Person8880 Offline
gpj.ecafllorT
*******
Posts: 2,407
Threads: 45
Joined: Sep 2013
RE: globaltables doesn't keep data between sf instances...
I used your code in the following way:

1. Spawned a chip containing:
local Vehicle = ents.self():isWeldedTo()
globaltables.global.IntelliHUD = {}
globaltables.global.IntelliHUD[ Vehicle:index() ] = { ZPM = ents.self() }

This chip is welded to a chair.

2. Spawned a second chip with:
local plysVeh = {}
local plysData = { [ ents.owner() ] = {} }
local plysForceSend = {}
local function CheckPlayerSeats(p)
if (globaltables.global.IntelliHUD == nil) then
return
end

if (p:inVehicle()) then
if (not(plysVeh[p] == p:vehicle())) then
plysVeh[p] = p:vehicle()
local e = p:vehicle()
if (IsValid(e) and not(globaltables.global.IntelliHUD[e:index()] == nil)) then
local data = globaltables.global.IntelliHUD[e:index()]
print( data, data.ZPM )
if (IsValid(data.ZPM) and data.ZPM:class() == "starfall_processor") then
plysData[p].VehData = {EnergyEntity = data.ZPM:getWirelink(), Name = data.Name, NameColor = data.NameColor}
end
end
end
if (not(plysData[p].VehData == nil)) then
local en = plysData[p].VehData.EnergyEntity
if (IsValid(en)) then
if (not(plysData[p].VehData.PEnergy == en["P"])) then
plysData[p].VehData.PEnergy = en["P"]
plysForceSend[p] = true
end
end
end
elseif (IsValid(plysVeh[p])) then
plysVeh[p] = nil
plysData[p].VehData = nil
plysForceSend[p] = true
end
end

timer.create( "bleh", 1, 0, function() CheckPlayerSeats( ents.owner() ) end )

When I sat down, I got a successful print message (of the table and the first chip). Getting out of the chair and sitting back down also worked. This leaves the only logical conclusion that there must be a problem in how you are setting up your vehicles that is outside of the code you've given here.
Find
Reply
« Next Oldest | Next Newest »


Messages In This Thread
globaltables doesn't keep data between sf instances... - by Yuri6037 - 04-11-2015, 09:47 AM
RE: globaltables doesn't keep data between sf instances... - by Person8880 - 04-11-2015, 06:36 PM
RE: globaltables doesn't keep data between sf instances... - by Yuri6037 - 05-11-2015, 11:43 AM
RE: globaltables doesn't keep data between sf instances... - by TheOneAndOnlyTee - 05-11-2015, 01:30 PM
RE: globaltables doesn't keep data between sf instances... - by Yuri6037 - 05-11-2015, 06:13 PM
RE: globaltables doesn't keep data between sf instances... - by Person8880 - 05-11-2015, 06:56 PM
RE: globaltables doesn't keep data between sf instances... - by TheOneAndOnlyTee - 06-11-2015, 02:58 AM
RE: globaltables doesn't keep data between sf instances... - by Yuri6037 - 06-11-2015, 08:15 AM
RE: globaltables doesn't keep data between sf instances... - by Yuri6037 - 06-11-2015, 01:00 PM

  • View a Printable Version
Forum Jump:


Users browsing this thread: 1 Guest(s)
Contact UsTeam Spartan Cookies & MilkReturn to TopLite (Archive) ModeMark all forums readRSS Syndication

Powered By MyBB, © 2002-2026 MyBB Group.