Shadow Dan
Sh4dowDan
It is not supporting names of looktype, just numbers like /looktype 122
Can anyone upgrade this script to work with an example: /looktype demon
After writing "/looktype demon" there is an error:
Script:
Working example for older TFS versions:
Problem solved, here is script made by Limos:
Can anyone upgrade this script to work with an example: /looktype demon
After writing "/looktype demon" there is an error:
Code:
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/looktype.lua:onSay
data/talkactions/scripts/looktype.lua:7: attempt to compare number with nil
stack traceback:
[C]: in function '__le'
data/talkactions/scripts/looktype.lua:7: in function <data/talkactions/scripts/looktype.lua:1>
Code:
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local lookType = tonumber(param)
if lookType >= 0 and lookType ~= 1 and lookType ~= 135 and lookType ~= 411 and lookType ~= 415 and lookType ~= 424 and (lookType <= 160 or lookType >= 192) and lookType ~= 439 and lookType ~= 440 and lookType ~= 468 and lookType ~= 469 and (lookType < 474 or lookType > 485) and lookType ~= 501 and lookType ~= 518 and lookType ~= 519 and lookType ~= 520 and lookType ~= 524 and lookType ~= 525 and lookType ~= 536 and lookType ~= 543 and lookType ~= 549 and lookType ~= 576 and lookType ~= 581 and lookType ~= 582 and lookType <= 595 then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("A look type with that id does not exist.")
end
return false
end
Working example for older TFS versions:
Code:
local function checkType(value)
return not (
value <= 1 or
value == 135 or
(value > 160 and value < 192) or
value == 411 or
value == 415 or
value == 424 or
(value > 438 and value < 441) or
(value > 466 and value < 470) or
value == 474 or
value == 485 or
value == 501 or
value > 590
)
end
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
return true
end
local t, pid = string.explode(param, ","), cid
if(t[2]) then
pid = getPlayerByNameWildcard(t[2])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
return true
end
end
local period, tmp = -1, tonumber(t[3])
if(t[3] and tmp) then
period = tmp
end
if(not isNumeric(t[1])) then
if(getMonsterInfo(t[1])) then
doSetMonsterOutfit(pid, t[1], period)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
end
return true
end
t[1] = tonumber(t[1])
if(not checkType(t[1])) then
local item = getItemInfo(t[1])
if(item) then
doSetItemOutfit(pid, t[1], period)
return true
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Such outfit does not exist.")
return true
end
local tmp = getCreatureOutfit(pid)
tmp.lookType = t[1]
if(t[3]) then
t[3] = tonumber(t[3])
if(checkType(t[3])) then
tmp.lookMount = t[3]
end
end
doCreatureChangeOutfit(pid, tmp)
return true
end
Problem solved, here is script made by Limos:
Code:
function onSay(player, words, param)
if not player:getGroup():getAccess() then
return true
end
local lookType = tonumber(param)
if not lookType then
lookType = MonsterType(param) and MonsterType(param):getOutfit().lookType
if not lookType then
player:sendCancelMessage("A monster with that name does not exist.")
return false
end
end
if lookType >= 0 and lookType ~= 1 and lookType ~= 135 and lookType ~= 411 and lookType ~= 415 and lookType ~= 424 and (lookType <= 160 or lookType >= 192) and lookType ~= 439 and lookType ~= 440 and lookType ~= 468 and lookType ~= 469 and (lookType < 474 or lookType > 485) and lookType ~= 501 and lookType ~= 518 and lookType ~= 519 and lookType ~= 520 and lookType ~= 524 and lookType ~= 525 and lookType ~= 536 and lookType ~= 543 and lookType ~= 549 and lookType ~= 576 and lookType ~= 581 and lookType ~= 582 and lookType <= 595 then
local playerOutfit = player:getOutfit()
playerOutfit.lookType = lookType
player:setOutfit(playerOutfit)
else
player:sendCancelMessage("A look type with that id does not exist.")
end
return false
end
Last edited: