• Npc Drop script for darkrp -- whats wrong??
    2 replies, posted
I am getting this error while turning on my server, ill show you whats on this line in a second, .... [gamemodes\darkrp\gamemode\init.lua:170 '(' expected near 'GM' [cpp] There was a problem opening the gamemode file 'DarkRP/gamemode/init.lua' This is Line 170... this is extreemly extreemly irritating.. DarkRP doesnt like being edited does it haha.. can anyone point me to whats wrong?? [LUA] -function GM:OnNPCKilled( Victim, Killer, Weapon) local Rand = math.random(1, 5) local SpawnHeight = 100 local NpcPos = Victim:GetPos() local Drop if rand == 1 then Drop = ents.Create("weapon_mad_medic") Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos Drop:Spawn() -- Drop The Weapon Drop:Activate() --Activate The Weapon elseif rand == 2 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif rand == 3 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif rand == 4 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif rand == 5 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon end end[/LUA]
You have a dash infront of function at the top. You used rand instead of Rand for the random number.
[QUOTE=Chessnut;34346726]You have a dash infront of function at the top. You used rand instead of Rand for the random number.[/QUOTE] Thanks! ill try that and ill post back if it helped so I dont be one of those hey thanks it fixed it people and run off.. haha.. **EDIT** your epic! thanks! haha heres the code for anyone else [LUA] function GM:OnNPCKilled( Victim, Killer, Weapon) local Rand = math.random(1, 5) local SpawnHeight = 100 local NpcPos = Victim:GetPos() local Drop if Rand == 1 then Drop = ents.Create("weapon_mad_medic") Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos Drop:Spawn() -- Drop The Weapon Drop:Activate() --Activate The Weapon elseif rand == 2 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif Rand == 3 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif Rand == 4 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon elseif Rand == 5 then --Drop = ents.Create("weapon_pistol") --Drop:SetPos(NpcPos+Vector(0, 0, SpawnHeight)) -- Set Drop Pos --Drop:Spawn() -- Drop The Weapon --Drop:Activate() --Activate The Weapon end end[/LUA]
Sorry, you need to Log In to post a reply to this thread.