Hey guy's, i'm new at programming, and just wanna know what i have done wrong.
Coding
[CODE]
CarDealerClosed = true
local midW, midH = ScrW / 2, ScrH / 2
local CarFrame = vgui.Create("DFrame")
CarFrame:SetSize( 500, 500 )
CarFrame:SetPos( midW - ( SHPage:GetWide() / 2 ), midH - (SHPage:GetTall() / 2 ) )
CarFrame:SetTitle("CarDealerFrame")
if CarDealerClosed == true then
CarFrame:SetVisible( false )
CarFrame:Close()
end
local function CarDealer( ply , text, team )
if string.sub( text, 1, 11) == "!bilhandler" then
CarFrame:SetVisible( true )
CarFrame:Show()
CarDealerClosed = true
end
end
hook.Add( "PlayerSay", "CarDealer", CarDealer )
[/CODE]
Console Error
[CODE]There is 1 Lua problem!
Please check your console for more information!
[ERROR] A runtime error has occurred in "addons/darkrpmodification-master/lua/darkrp_modules/cardealer/sv_config.lua" on line 4.
The best help I can give you is this:
attempt to perform arithmetic on global 'ScrW' (a nil value)
Hints:
- No hints, sorry.
The responsibility for this error lies with (the authors of) one (or more) of these files:
1. addons/darkrpmodification-master/lua/darkrp_modules/cardealer/sv_config.lua on line 4
2. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
3. gamemodes/darkrp/gamemode/libraries/fn.lua on line 82
4. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 92
5. gamemodes/darkrp/gamemode/libraries/modificationloader.lua on line 147
6. gamemodes/darkrp/gamemode/init.lua on line 87
------- End of Simplerr error -------
[/CODE]
- Raz
Should be ScrW() and ScrH(). They are functions returning the screen height/width, not global variables.
P4sca1 is on the right.
PlayerSay is a serverside hook, you need to use the networking library and send a net message to open that hook, and seperate the clientside and serverside.
Use this networking guide:
[url]https://wiki.garrysmod.com/page/Net_Library_Usage[/url]
Note, you need to send a message from a server to a client.
I think i should start programming some more simpel stuff :)
- But Thanks for the replies. Raz
[QUOTE=RazMouze;49370294]I think i should start programming some more simpel stuff :)
- But Thanks for the replies. Raz[/QUOTE]
If you'd like to get into coding, you can catch me up on steam, i usually help people start coding, and help with questions.
[QUOTE=tzahush;49370418]If you'd like to get into coding, you can catch me up on steam, i usually help people start coding, and help with questions.[/QUOTE]
Done, big thanks. :)
- Raz
Sorry, you need to Log In to post a reply to this thread.