brendan2
Sensation black
- Joined
- Feb 19, 2009
- Messages
- 507
- Reaction score
- 1
Ok anyways i dont no how to make the mining script give players mining skill? I dont want a npc to give players mining skill i just want people to have it.
PHP:
--- Mining V3.2 all credits by Virgel
--- Player need to learn mining
--- Player has miningskill and trys
--- Pick will break after a while
--- field to mine can become empty (empty field will change to mining ground after x.minutes)
--- talkaction with command !mining
function onUse(cid, item, frompos, item2, topos)
playerCanMine = getPlayerStorageValue(cid,40001) --- player can mine yes 1 or no 0
playerSkillMine = getPlayerStorageValue(cid,40002) --- Miningskill from player
playerSkillTry = getPlayerStorageValue(cid,40003) --- this counts the efective trys
playerPickBroken = getPlayerStorageValue(cid,40004) --- counts how often you work with a pick
multipler = 1.5 --- when its higher peoples need to mine longer for next skillup, remember to change this in talkactions also!
brokePick = math.random(20,40) --- how many trys before a pick will break
needSkillTry = math.ceil(playerSkillMine * playerSkillMine * multipler - 1)
if playerCanMine > 0 and item2.itemid == 4328 then
------- miningskills start here ------
if playerSkillMine >= 1 and playerSkillMine<= 10 then
if playerPickBroken < brokePick then
newPlayerPickBroken = playerPickBroken+1
setPlayerStorageValue(cid,40004, newPlayerPickBroken)
rand = math.random(1,100)
if rand <= 20 then
newPlayerSkillTry = playerSkillTry + 1
setPlayerStorageValue(cid,40003, newPlayerSkillTry)
doPlayerAddItem(cid,5880,1)
doPlayerSendTextMessage(cid,22,"You have found 1 iron ore!")
if playerSkillTry >= needSkillTry then
newPlayerSkillMine = playerSkillMine + 1
setPlayerStorageValue(cid,40003,0)
nowPlayerSkillMine = getPlayerStorageValue(cid,40002)
doPlayerSendTextMessage(cid,22,"You advanced in mining! You Miningskill is "..nowPlayerSkillMine.." now!")
end
elseif rand >20 and rand <=50 then
doPlayerSendTextMessage(cid,22,"Found nothing!")
elseif rand >50 and rand <=73 then
newPlayerSkillTry = playerSkillTry + 1
setPlayerStorageValue(cid,40003, newPlayerSkillTry)
doPlayerAddItem(cid,5880,2)
doPlayerSendTextMessage(cid,22,"You have found 2 iron ore!")
if playerSkillTry >= needSkillTry then
newPlayerSkillMine = playerSkillMine + 1
setPlayerStorageValue(cid,40002,newPlayerSkillMine)
setPlayerStorageValue(cid,40003,0)
nowPlayerSkillMine = getPlayerStorageValue(cid,40002)
doPlayerSendTextMessage(cid,22,"You advanced in mining! You Miningskill is "..nowPlayerSkillMine.." now!")
end
elseif rand >73 and rand <=78 then
doPlayerAddItem(cid,1294,2)
doPlayerSendTextMessage(cid,22,"You have found 2 stones!")
elseif rand >78 and rand <85 then
doTransformItem(item2.uid, 4329)
doDecayItem(item2.uid)
doPlayerSendTextMessage(cid,22,"This mine is empty!")
elseif rand >=85 and rand <=100 then
doPlayerSendTextMessage(cid,22,"Found nothing!")
end
else
doRemoveItem(item.uid,1)
doSendMagicEffect(topos,2)
setPlayerStorageValue(cid,40004,0)
doPlayerSendTextMessage(cid,22,"Your pick has been damaged and broke...")
end
------- start next miningskill stage here (start with elseif) ------
------- miningskills end here
end
elseif item2.itemid == 4329 then
doPlayerSendTextMessage(cid,22,"This mine is empty!")
elseif playerSkillMine < 1 then
doPlayerSendTextMessage(cid,22,"You need to learn mining first!")
else
doPlayerSendTextMessage(cid,22,"You need to be in a Mine!")
end
end