is there anyway to get the a player/creature position by its NameWildcard ??
well this is what im trying to do.. i want to use a talkaction that gets you the monters name of a radius near a player so you can be able to know what is the player fighting at or what is near to him..
the idea isnt mine.. i got this script from Sync @ otland so lets see if you can help me a bit
thanks!
well this is what im trying to do.. i want to use a talkaction that gets you the monters name of a radius near a player so you can be able to know what is the player fighting at or what is near to him..
the idea isnt mine.. i got this script from Sync @ otland so lets see if you can help me a bit
PHP:
function getMonstersFromArena(pos, radiusx, radiusy, stack)
local monsters = {}
local starting = {x = (pos.x - radiusx), y = (pos.y - radiusy), z = pos.z}
local ending = {x = (pos.x + radiusx), y = (pos.y + radiusy), z = pos.z}
for x = starting.x, ending.x do
for y = starting.y, ending.y do
for z = starting.z, ending.z do
local pos = {x=x, y=y, z=z,stackpos = stack}
local thing = getThingfromPos(pos)
if thing.itemid > 0 then
if isMonster(thing.uid) == TRUE then
table.insert (monsters, thing.uid)
break
end
end
end
end
end
return monsters
end
function onSay(cid, words, param, channel)
local pos = getCreaturePosition(cid)
local config = {
monsters = getMonstersFromArena({x = pos.x,y = pos.y,z = pos.z}, 2, 2, 253),
target = getPlayerByNameWildcard(param),
price = 10, -- Ammount in Gold Coins
letter = doPlayerAddItem(cid, 2598) -- 2589 is a Letter
}
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires a players name.")
return TRUE
end
for i = 1, #config.monsters do
if(doPlayerRemoveMoney(cid, config.price) == TRUE) then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "New mail has Arrived.")
doSetItemText(config.letter, "Dear Player, I have searched feircely to find "..getCreatureName(config.target)..", Luckily i am a great spy and have found his current enemy that surrounded him! The target he was surrounded by was a "..getCreatureName(config.monsters[i]).."!")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You need "..config.price.." gold in order to use this command.")
end
return TRUE
end
end
thanks!
Last edited: