Yes, if you do if (SERVER) .. end
Edit: Post the new code maybe? Use code tags this tim
[QUOTE=martinkordi;52434434]I'm back at this error ....[/QUOTE]
Well we got rid of that error, so that's good! Can you show us line 79 of dframe.lua?
[editline]5th July 2017[/editline]
[QUOTE=Invule;52434429]Well its not.
debug with prints to see ifs actually ran.[/QUOTE]
shrekt :buckteeth:
[QUOTE=Lavacoal123;52434420]To be fair I just found out about the Net Library, looks like it has some good potential though.
Anyway, I think you need the
[CODE]
util.AddNetworkString("give_wep")
[/CODE]
in the beginning of the client script.[/QUOTE]
Not needed, will simply produce a Lua error as that function is undefined on the client.
That error simply won't occur if you have [B]util.AddNetworkString("give_wep")[/B] on the server, so you're doing [I]something[/I] wrong
Yes, I'll show you.
[QUOTE=Lavacoal123;52434436]Well we got rid of that error, so that's good! Can you show us line 79 of dframe.lua?
[editline]5th July 2017[/editline]
shrekt :buckteeth:[/QUOTE]
No reason for 2 people to help at the same time, he'll get confused. You're clearly very experienced when it comes to running serverside functions on the client so I'll leave, gl.
[code]function PANEL:SetTitle( strTitle )
self.lblTitle:SetText( strTitle )
end [/code]
[editline]5th July 2017[/editline]
This is line 79
[editline]5th July 2017[/editline]
Well all I did is copy and paste the codes from Mr. Lava and other guys ( Thanks for that a lot! )
[QUOTE=Lavacoal123;52434436]Well we got rid of that error, so that's good! Can you show us line 79 of dframe.lua?[/QUOTE]
That's a default gmod file, you can see it yourself in github.
What we need to see is [B]addons/cn_npc/lua/cn_npc_system/cl_quest.lua:135[/B]
So from now, what am I suppost to do?
[QUOTE=martinkordi;52434451]Yes, I'll show you.[/QUOTE]
GitHub?
[QUOTE=Invule;52434452]No reason for 2 people to help at the same time, he'll get confused. You're clearly very experienced when it comes to running serverside functions on the client so I'll leave, gl.[/QUOTE]
A little speculation never hurt anyone.
[QUOTE=martinkordi;52434458]So from now, what am I suppost to do?[/QUOTE]
Learn how to code.
You have a string that is nil and you're using it in a function.
What even is this code? What is [B]addons/cn_npc/lua/cn_npc_system/cl_quest.lua[/B]? What are you trying to accomplish in all of this?
[QUOTE=Lavacoal123;52434459]GitHub?
A little speculation never hurt anyone.[/QUOTE]
Okey, just a second
[editline]5th July 2017[/editline]
[QUOTE=martinkordi;52430697]This is the line in dframe
function PANEL:SetTitle( strTitle )
self.lblTitle:SetText( strTitle )
end
[editline]4th July 2017[/editline]
Shouks i remove local?
[editline]4th July 2017[/editline]
This ia line 35
cnPanels.quest:setup(uniqueID)
if (cnQuests[uniqueID].onStart) then
cnQuests[uniqueID]:onStart()
end
end
end)
[editline]4th July 2017[/editline]
This is line 135
self:SetTitle(data.name)
[editline]4th July 2017[/editline]
All i want is when you press "i need training weapon" then you should get one[/QUOTE]
This is what im trying to do... And isn't this a good way to learn?
[editline]5th July 2017[/editline]
[QUOTE=Lavacoal123;52434459]GitHub?
A little speculation never hurt anyo
[url]https://github.com/martinkordi/helpne[/url].[/QUOTE]
[editline]5th July 2017[/editline]
[QUOTE=martinkordi;52434462]Okey, just a second
[editline]5th July 2017[/editline]
This is what im trying to do... And isn't this a good way to learn?
[editline]5th July 2017[/editline][/QUOTE]
whoops, use this one
[url]https://github.com/martinkordi/help[/url]
cl_quest.lua isn't on here.
Ah, I know exactly what addon you're using! Should've mentioned you were using this: [url]https://www.gmodstore.com/scripts/view/1574/chessnuts-npc-framework[/url]
Anyways, here's what you need:
cl_init.lua
[CODE]
NPC.name = "Imperial Officer"
function NPC:onStart()
self:addText("Hi, what do you need?")
self:addOption("How do I get trained?", function()
self:addText("Ask someone to train you by typing /comms I need trainer.")
self:addLeave("Thanks!")
end)
self:addOption("How do I donate?", function()
self:addText("Type !donate or !shop and you will see all information there. Be sure to read our TOS!")
self:addLeave("Thanks!")
end)
self:addOption("How do I become one of the High Inquisitors or how do I become Commander?", function()
self:addText("Type !website and look at our applications, there you can apply for them.")
self:addLeave("Thanks!")
end)
self:addOption("I see a lot of errors, how do I fix that?", function()
self:addText("Type !content in chat and subscribe to our content.")
self:addLeave("Thanks!")
end)
self:addOption("I have a suggestion, where do I post it?", function()
self:addText("Type !suggestions in chat and post a suggestion or post it on our forums by typing !website.")
self:addLeave("Thanks!")
end)
self:addOption("I need a training weapon", function()
self:send( "GiveTrainingWeapon" )
self:addText("Here you go.")
self:addLeave("Thanks!")
end)
end
[/CODE]
sv_init.lua:
[CODE]
NPC.model = "models/player/group01/male_05.mdl" -- Replace this with the model you want
NPC.color = Vector(1, 0, 0) -- Replace this with the color you want
function NPC:onGiveTrainingWeapon( ply )
ply:Give( "tfa_e11_training" )
end
[/CODE]
These two should go in "garrysmod/addons/cn_npc/lua/cn_npcs/imperialofficer" or something alone those lines. Basically where you got the sv_init.lua and cl_init.lua files. I believe the original folder is called "test", you can rename to "imperialofficer" to make it easier for you.
Not sure if you edited anything in the core files, but if you have just delete & redownload the script, then do your configuration.
cl_quest is in another folder, the core folder. sec
[QUOTE=JasonMan34;52434460]Learn how to code.
You have a string that is nil and you're using it in a function.
What even is this code? What is [B]addons/cn_npc/lua/cn_npc_system/cl_quest.lua[/B]? What are you trying to accomplish in all of this?[/QUOTE]
Give him a break, he's trying to learn to code just as I still am.
[editline]5th July 2017[/editline]
[QUOTE=martinkordi;52434487]cl_quest is in another folder, the core folder. sec[/QUOTE]
So is the core folder where all these weird functions are defined?
last 4 files are the core files
[QUOTE=Silhouhat;52434485]Ah, I know exactly what addon you're using! Should've mentioned you were using this: [url]https://www.gmodstore.com/scripts/view/1574/chessnuts-npc-framework[/url]
Anyways, here's what you need:
cl_init.lua
[CODE]
NPC.name = "Imperial Officer"
function NPC:onStart()
self:addText("Hi, what do you need?")
self:addOption("How do I get trained?", function()
self:addText("Ask someone to train you by typing /comms I need trainer.")
self:addLeave("Thanks!")
end)
self:addOption("How do I donate?", function()
self:addText("Type !donate or !shop and you will see all information there. Be sure to read our TOS!")
self:addLeave("Thanks!")
end)
self:addOption("How do I become one of the High Inquisitors or how do I become Commander?", function()
self:addText("Type !website and look at our applications, there you can apply for them.")
self:addLeave("Thanks!")
end)
self:addOption("I see a lot of errors, how do I fix that?", function()
self:addText("Type !content in chat and subscribe to our content.")
self:addLeave("Thanks!")
end)
self:addOption("I have a suggestion, where do I post it?", function()
self:addText("Type !suggestions in chat and post a suggestion or post it on our forums by typing !website.")
self:addLeave("Thanks!")
end)
self:addOption("I need a training weapon", function()
self:send( "GiveTrainingWeapon" )
self:addText("Here you go.")
self:addLeave("Thanks!")
end)
end
[/CODE]
sv_init.lua:
[CODE]
NPC.model = "models/player/group01/male_05.mdl" -- Replace this with the model you want
NPC.color = Vector(1, 0, 0) -- Replace this with the color you want
function NPC:onGiveTrainingWeapon( ply )
ply:Give( "tfa_e11_training" )
end
[/CODE]
These two should go in "garrysmod/addons/cn_npc/lua/cn_npcs/imperialofficer" or something alone those lines. Basically where you got the sv_init.lua and cl_init.lua files. I believe the original folder is called "test", you can rename to "imperialofficer" to make it easier for you.
Not sure if you edited anything in the core files, but if you have just delete & redownload the script, then do your configuration.[/QUOTE]
Oh wow. This makes things so much easier.
there you go cl_quests
[editline]5th July 2017[/editline]
Im not allowed to upload the othger ones
wait wait wait. This is a scriptfodder addon?
Just make a support ticket
Also
[QUOTE=Lavacoal123;52434489]Give him a break, he's trying to learn to code just as I still am.
[/QUOTE]
Trying to help when you're still a beginner is sometimes worse than not helping at all.
A lot of the things you said were wrong/wastes of time
It seems that data.name is undefined again, but it would do you good if you just re downloaded the core files.
Okey, going to tell you if it works now. I haven't edited anything in core files.
[QUOTE=JasonMan34;52434505]wait wait wait. This is a scriptfodder addon?
Just make a support ticket
Also
Trying to help when you're still a beginner is sometimes worse than not helping at all.
A lot of the things you said were wrong/wastes of time[/QUOTE]
From the store page:
[IMG]http://silhouhat.com/img/XTIMr[/IMG]
He should've read the description, to be fair.
it works now, the script works, I know, I did a bad thing, wasted all of your time, and I'm sorry for that, I just wanted to see if this is actually possible and how it works, I'm sorry if I interupted you in anything. Thank you for solving my problem.
[QUOTE=JasonMan34;52434505]wait wait wait. This is a scriptfodder addon?
Just make a support ticket
Also
Trying to help when you're still a beginner is sometimes worse than not helping at all.
A lot of the things you said were wrong/wastes of time[/QUOTE]
I know a few things. I mean, I came a long way, at least in my opinion.
A long way. [url]https://facepunch.com/showthread.php?t=1527380[/url]
[editline]5th July 2017[/editline]
[QUOTE=martinkordi;52434515]it works now, the script works, I know, I did a bad thing, wasted all of your time, and I'm sorry for that, I just wanted to see if this is actually possible and how it works, I'm sorry if I interupted you in anything. Thank you for solving my problem.[/QUOTE]
No problem. I mean the forum says you're in Croatia (unless you have a VPN) and you speak fluent English so props to you.
Yeah I'm from Croatia. English is not my native.
Sorry, you need to Log In to post a reply to this thread.