I would like to simplify this script I'm doing. I started doing the script, but if I continue like this I will take a long time.
Please help me!
Please help me!
Code:
local drop3060 = 96609765002
local rand3060 = math.random(1, 100)
local drop6090 = 96609765003
local rand6090 = math.random(1, 100)
local drop90120 = 96609765004
local rand90120 = math.random(1, 100)
local msg = "Found a weapon!"
function onKill(cid, target, lastHit)
if isMonster(target) == true then
if getPlayerLevel(cid) > 29 and getPlayerLevel(cid) <= 60 then
if getPlayerStorageValue(cid, drop3060) == 1 then
if getCreatureName(target) == "Chakoya Tribewarden" or getCreatureName(target) == "Cyclops" or getCreatureName(target) == "Cyclops Drone" or getCreatureName(target) == "Frost Giant" or getCreatureName(target) == "Frost Giantess" or getCreatureName(target) == "Goblin" or getCreatureName(target) == "Goblin Assassin" or getCreatureName(target) == "Goblin Leader" or getCreatureName(target) == "Goblin Scavenger" or getCreatureName(target) == "Lizard Templar" or getCreatureName(target) == "Pirate Skeleton" or getCreatureName(target) == "Smuggler" or getCreatureName(target) == "Smuggler Baron Silvertoe" then
if rand3060 > 0 and rand3060 <= 5 then
-------------------------------- Rand3060 is equal 5% of 100%
doPlayerAddItem(cid, 2406, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
elseif getCreatureName(target) == "Crypt Shambler" or getCreatureName(target) == "Braindeath" then
if rand3060 > 0 and rand3060 <= 5 then
-------------------------------- Rand3060 is equal 5% of 100%
doPlayerAddItem(cid, 2450, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
end
end
elseif getPlayerLevel(cid) > 60 and getPlayerLevel(cid) <= 90 then
if getPlayerStorageValue(cid, drop6090) == 1 then
if getCreatureName(target) == "Quara Predator" or getCreatureName(target) == "Thul" or getCreatureName(target) == "Werewolf" or getCreatureName(target) == "Madareth" then
if rand6090 > 0 and rand6090 <= 4 then
-------------------------------- Rand6090 is equal 4% of 100%
doPlayerAddItem(cid, 7855, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
elseif getCreatureName(target) == "Demon" then
if rand6090 > 0 and rand6090 <= 4 then
-------------------------------- Rand6090 is equal 4% of 100%
doPlayerAddItem(cid, 2407, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
end
end
elseif getPlayerLevel(cid) > 90 and getPlayerLevel(cid) <= 120 then
if getPlayerStorageValue(cid, drop90120) == 1 then
if getCreatureName(target) == "Dipthrah" or getCreatureName(target) == "Horestis" then
if rand90120 > 0 and rand90120 <= 3 then
-------------------------------- Rand90120 is equal 3% of 100%
doPlayerAddItem(cid, 2446, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
elseif getCreatureName(target) == "Quara Predator" or getCreatureName(target) == "Spectre" or getCreatureName(target) == "Thul" or getCreatureName(target) == "Werewolf" or getCreatureName(target) == "Madareth" then
if rand90120 > 0 and rand90120 <= 3 then
-------------------------------- Rand90120 is equal 3% of 100%
doPlayerAddItem(cid, 7383, 1)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, msg)
end
end
end
end
end
return true
end