Here's the thing, I have mounts working, but before adding quests/items/npcs or w/e to the server for the player to get the mounts, I'm creating a command for it.
And there comes the problem, I managed to get the mounts on my God character, but I can't give it to anyone >_<
Whenever I type "/mount", I get all the mounts, but when I say any name, nothing happens and the command appear in my default window in yellow.
I've written and rewritten this a few times, lol, this is my lastest try:
Btw, in this lastest try, when I say "/mount" I get all the mounts and then an "Invalid player name."
and a console error about getting the player.
And there comes the problem, I managed to get the mounts on my God character, but I can't give it to anyone >_<
Whenever I type "/mount", I get all the mounts, but when I say any name, nothing happens and the command appear in my default window in yellow.
I've written and rewritten this a few times, lol, this is my lastest try:
LUA:
-- Mount Command - by Druid Elf
-- /mount - gives GM/GOD/CM all mounts
-- /mount PLAYERNAME - gives player all mounts
-- /mount PLAYERNAME, ID - gives player mount with ID equal to ID
-- /mount PLAYERNAME, remove - removes player mounts
function onSay(cid, words, param, channel)
if(param == "") then
for i = 1,20 do
doPlayerAddMountEx(cid, i)
end
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_RED)
doCreatureSay(cid, "Mounts, HURRAY!", TALKTYPE_ORANGE)
end
local player, id
param = string.explode(param, ",")
if not param[2] then
if not getPlayerByNameWildcard(param[1]) or getPlayerByNameWildcard(param[1]) == "" then
return doPlayerSendCancel(cid, "Invalid player name.")
else
player = getPlayerByNameWildcard(param[1])
for i = 1,20 do
doPlayerAddMountEx(player, i)
end
doSendMagicEffect(getPlayerPosition(player), CONST_ME_MAGIC_RED)
doCreatureSay(player, "Mounts, HURRAY!", TALKTYPE_ORANGE)
end
end
if (param[2] ~= 0) then
player, id = getPlayerByNameWildcard(param[1]), param[2]
id = type(ach) == "string"
if (id <= 0) and (id >= 21) then
doPlayerSendCancel(cid, "Invalid mount ID.")
else
doPlayerAddMountEx(player, id)
doSendMagicEffect(getPlayerPosition(player), CONST_ME_MAGIC_RED)
doCreatureSay(player, "You received a new mount!", TALKTYPE_ORANGE)
end
elseif (param[2] == "remove") then
player = getPlayerByNameWildcard(param[1])
for i = 1,20 do
doPlayerRemoveMountEx(player, i)
end
doSendMagicEffect(getPlayerPosition(player), CONST_ME_MAGIC_RED)
doCreatureSay(player, "No mounts!", TALKTYPE_ORANGE)
end
return true
end
Btw, in this lastest try, when I say "/mount" I get all the mounts and then an "Invalid player name."