• Cant Use Hooks [[ERROR] attempt to index a nil value 1. unknown - lua/shared.lua:12]
    2 replies, posted
here is my code : [CODE]if SERVER then local function removewep(ply,wep) if ply:HasGodMode() then return false else return true end end hook.Add( "AllowPlayerPickup","pickupwep",removewep). hook.Add( "PlayerSay", "chatcommand", function(ply,text,isTeam) local texts = string.Explode(" ",text) if string.lower(texts[1]) == "!build" and texts[2] == nil then ply:StripWeapons() ply:GodEnable() ply:Give("weapon_physgun") ply:Give("gmod_tool") ply:Give("weapon_physcannon") ply:Give("gmod_camera") ply:ChatPrint("PVP 'den ciktiniz.Bu durumdayken herhangi birini oldurmeniz yasaktir. PVP ' e katilmak icin !pvp yazin") end if string.lower(texts[1]) == "!pvp" and texts[2] == nil then ply:GodDisable() ply:Give("weapon_physgun") ply:Give("gmod_tool") ply:Give("weapon_physcannon") ply:Give("weapon_crowbar") ply:Give("weapon_pistol") ply:Give("weapon_357") ply:Give("weapon_smg1") ply:Give("weapon_ar2") ply:Give("weapon_shotgun") ply:Give("weapon_crossbow") ply:Give("weapon_rpg") ply:Give("weapon_frag") ply:ChatPrint("PVP 'e Katildiniz.") end end) local function dontspawn(ply,ent) if ply:HasGodMode() then ply:StripWeapon(ent) ply:ChatPrint("Buildde iken silah alamazsın") end end hook.Add("PlayerSpawnedSWEP","dontspawn",dontspawn) local function DisableNoclip( ply ) return ply:HasGodMode() end hook.Add( "PlayerNoClip", "DisableNoclip", DisableNoclip ) end [/CODE]
Pretty sure the period after the AllowPlayerPickup hook is your problem. [code] hook.Add( "AllowPlayerPickup","pickupwep",removewep). --should be hook.Add( "AllowPlayerPickup","pickupwep",removewep) [/code]
[QUOTE=AK to Spray;48017884]Pretty sure the period after the AllowPlayerPickup hook is your problem. [code] hook.Add( "AllowPlayerPickup","pickupwep",removewep). --should be hook.Add( "AllowPlayerPickup","pickupwep",removewep) [/code][/QUOTE] OMG THX i was trying to solve this for 2 hours :dance:
Sorry, you need to Log In to post a reply to this thread.