• Help me guys! init.lua
    5 replies, posted
How do you to issue a gun license if it is not ? (DARKRP) [CODE] else if not ( LocalPlayer():getDarkRPVar("HasGunlicense") ) then LocalPlayer():getDarkRPVar("HasGunlicense") ply:addMoney( -180 )[/CODE]
This isn't DarkRP help forum. Please take it to DarkRP forums. Also, your code doesn't make really sense, on the second line you're returning literally false or true to nothing. Fixing your problem, it should look like: [code]elseif LocalPlayer():getDarkRPVar("HasGunlicense") then ply:addMoney(-180)[/code] The code above won't work either - Your code has MANY, MANY mistakes - First, it seems like you're trying to run it on CLIENT, thus that's why ply:addMoney(-180) won't work, because it is serverside function. LocalPlayer() exists only in clientside, and I have a feeling that your code didn't define ply anywhere. Tell me, what you're trying to do? Is it a command, or something else? I might try to fix your problem for you, with simple explanation.
[code] not true = false not false = true [/code] [code] if ( true ) then print( "I get printed!" ) end if not ( false ) then print( "I get printed!" ) end [/code] [code] ply:setDarkRPVar("HasGunlicense", true) if ( ply:getDarkRPVar("HasGunlicense") ) then print( "I get printed!" ) end ply:setDarkRPVar("HasGunlicense", false) if not ( ply:getDarkRPVar("HasGunlicense") ) then print( "I get printed!" ) end [/code] idk
holymoly, yep, in my example I'd just reverse things around lol, thanks for pointing that out. fixed now.
You're mistaking LocalPlayer() == ply, which is false. LocalPlayer() doesn't exist on server lua (unless you define it for some odd reason). [code] if not ( ply:getDarkRPVar("HasGunlicense") ) then ply:setDarkRPVar( "HasGunlicense", true ) ply:addMoney( -180 ) end [/code]
[QUOTE=Potatofactory;50559561]You're mistaking LocalPlayer() == ply, which is false. LocalPlayer() doesn't exist on server lua (unless you define it for some odd reason). [code] if not ( ply:getDarkRPVar("HasGunlicense") ) then ply:setDarkRPVar( "HasGunlicense", true ) ply:addMoney( -180 ) end [/code][/QUOTE] Thanks man! I love youuu
Sorry, you need to Log In to post a reply to this thread.