• attempt to call field 'AddNetworkString' (a nil value)
    2 replies, posted
So i'm trying to make a simple exam system for my server,but when i tryin to addnetworkstring it returns a nil value. P.s i'm doing it on serverside Here's the code: sv: util.AddNetworkString("passedexam") util.AddNetworkString("failedexam") util.AddNetworkString("congr_exam") util.AddNetworkString("set_lvl_2") net.Receive("passedexam", teleport_from_spawn) function teleport_from_spawn(len, ply) ply:SetPos(Vector(-10645.467773, 8759.331055, 49.031250), Vector( 0, 0, 0 )) net.Start("congr_exam") net.Send(ply) end net.Receive("set_lvl_2", function(len, ply) game.ConsoleCommand("ulx setlevel "..ply:Nick().." 4") end) cl: function examframe() local frame = vgui.Create("DFrame") frame:SetSize(400, 300) frame:Center() frame:SetVisible(true) frame:MakePopup() local quest1 = vgui.Create("DLabel", frame) quest1:SetSize(100,25) quest1:SetPos(10,25) quest1:SetText("Question1") local answr1 = vgui.Create("DComboBox", frame) answr1:SetSize(100,45) answr1:SetPos(10,45) answr1:SetValue("Your Answer") answr1:AddChoice("Answer1") answr1:AddChoice("Answer2") answr1:AddChoice("AnswerОтвет3") local quest2 = vgui.Create("DLabel", frame) quest2:SetSize(100,25) quest2:SetPos(10,85) quest2:SetText("Question2") local answr2 = vgui.Create("DComboBox", frame) answr2:SetSize(100,45) answr2:SetPos(10,105) answr2:SetValue("Your Answer") answr2:AddChoice("Answer1") answr2:AddChoice("Answer2") answr2:AddChoice("Answer3") local finishbutton = vgui.Create("DButton", frame) finishbutton:SetSize(100,45) finishbutton:SetPos(150,250) finishbutton.DoClick = function(ply) if answr1:GetSelectedID() == 1 and answr2:GetSelectedID() == 3 then net.Start("passedexam") net.SendToServer() print(answr1:GetSelectedID()) print(answr2:GetSelectedID()) else notification.AddLegacy("You failed the exam", NOTIFY_HINT, 4) end frame:Close() end end hook.Add( 'OnPlayerChat', 'test_cmd', function( ply, txt, team, dead ) if txt == '!noobtest' and ply == LocalPlayer() and ply:getDarkRPVar("level") == 0 then vopros() else notification.AddLegacy("You don't need to do that", NOTIFY_HINT, 6) end end ) net.Receive("congr_exam", function(len) ChatPrint("Some cong") notification.AddLegacy("Teleported to default spawn", NOTIFY_HINT, 5) net.Start("set_lvl_2") net.SendToServer() end)
hook.Add( 'OnPlayerChat', 'test_cmd', function( ply, txt, team, dead ) if txt == '!noobtest' and ply == LocalPlayer() and ply:getDarkRPVar("level") == 0 then vopros() else notification.AddLegacy("You don't need to do that", NOTIFY_HINT, 6) end end ) what is vopros for a function? if u replace it with examframe() it will open your frame http://prntscr.com/i3h4ok
Well it opens now i guess i messed up with a code somewhere. But how to set level of user that passed exam?
Sorry, you need to Log In to post a reply to this thread.