• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

How to "getpos"

ziggy46802

Active Member
Joined
Aug 19, 2012
Messages
418
Reaction score
27
Here is my script for mining a crystal

Code:
function onUse(cid, item, frompos, item2, topos)

bigrock = 8634
smallrock = 8638
posa = {x=1049,y=1062,z=8}                                                                                        	--set position	
chance = math.random(0,100000)
brake = math.random(0,100)
mining = (getPlayerSkill(cid, FIST_SKILL) * 3)

function goto(cid, item)
	addEvent(restore, (1000 * 60 * 54),(1000 * 60 * 131) , cid) 
	--addEvent(restore, 5000,10000, cid) --test mode
	return true
end

function restore(cid, item1, item2)
		doRemoveItem(getTileItemById(posa, smallrock).uid)         
		doCreateItem(bigrock,posa)	                              
		doSetItemActionId(getTileItemById(posa, bigrock).uid, 4001) 												--set AID
			return true
end	

if item.itemid == bigrock and getPlayerItemCount(cid,2553) >= 1 and getPlayerSkill(cid, SKILL_FIST) >= 1 then                               
			doPlayerAddSkillTry(cid, SKILL_FIST, 10)
			doRemoveItem(getTileItemById(posa, bigrock).uid)
			doCreateItem(smallrock,posa)	
			addEvent(goto, 1, 2, cid)                               
			doSendMagicEffect(getPlayerPosition(cid), 13)
			
if brake > mining then
	doPlayerRemoveItem(cid, 2553, 1)
	doCreatureSay(cid, "Well shit, your fuckin pick broke man.", TALKTYPE_ORANGE_1)
		return false
	end	

if chance >= 0 and chance <= 50000 then
	doPlayerAddItem(cid, 2255,1)
	doCreatureSay(cid, "You found some trashy copper.", TALKTYPE_ORANGE_1)	
		return false
	end

if chance >= 50001 and chance <= 80000 then
	doPlayerAddItem(cid, 2254,1)
	doCreatureSay(cid, "You found some dirty copper.", TALKTYPE_ORANGE_1) 
		return false
	end

if chance >= 80001 and chance <= 95000 then
	doPlayerAddItem(cid, 2253,1)
	doCreatureSay(cid, "You found some dull copper.", TALKTYPE_ORANGE_1) 
		return false
	end
	
if chance >= 95001 and chance <= 100000 then
	doPlayerAddItem(cid, 2252,1)
	doCreatureSay(cid, "You found some decent copper.", TALKTYPE_ORANGE_1) 	
		return false
	end	
		return true
	end
		return true
	end

at the top for "posa", do I have to put that in for each and every crystal I put down, each one a different position, or is there some type of function that can like... "get pos from used item" or something like that so that I dont have to type in the coordinates every time and mess up every once in a while.
 
Back
Top