GoldenForge Error: attempt to call method 'GiveScrapMeatal' (a nil value)
0 replies, posted
Here is my gf_server.lua file
[lua]
timer.Create( "gsmem", 60, 0, function()
for k, v in pairs(GF.GetPlayers()) do
if v:IsUserGroup("vip") then
v:GiveScrapMeatal(15, "Thanks For Donating to the server, you get 15 more metal in 1 min")
else
v:GiveScrapMetal(2, "Thanks for playing on VDGN TTT Server, you recieve more metal in 1 min")
end
end
end)
[/lua]
It was working until i added my vipcheck script which is this one below
[lua]
require("mysqloo")
local DATABASE_HOST = "HOST"
local DATABASE_PORT = PORT
local DATABASE_NAME = "NAME_vip"
local DATABASE_USERNAME = "USERNAME_user"
local DATABASE_PASSWORD = "PASS"
local ID
for _, v in ipairs( player.GetAll() ) do
ID = v:SteamID()
function makeVIP()
v:SetUserGroup("vip")
end
end
function afterConnected(database)
local query1 = database:query("SELECT COUNT(*) FROM donators WHERE steamid = '" .. ID .. "'")
query1.onData = function(Q,D) print("Q1") PrintTable(D) end
query1.onSuccess = makeVIP
query1.onError = function(Q,E) print("Q1") print(E) end
query1:start()
end
function connectToDatabase()
local databaseObject = mysqloo.connect(DATABASE_HOST, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME, DATABASE_PORT)
databaseObject.onConnected = afterConnected
databaseObject:connect()
end
hook.Add("PlayerSpawn", "Connect to database", connectToDatabase)
[/lua]
The vipcheck sctipt seems to work but now the other one doesnt want to give the money...
Can anyone help?
[editline]6th September 2011[/editline]
You can remove this i didnt not notice that metal was misspelled :P
Sorry, you need to Log In to post a reply to this thread.