• 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!

Lua Problem with command (talkaction)

Thorn

Spriting since 2013
Joined
Sep 24, 2012
Messages
2,203
Solutions
1
Reaction score
921
Location
Chile
hello people of otland, well i have this problem, when the tutor use /bc comand to speak in red, the message is ok, but i want that that tha name of the tutor is in the message too, i don't know if i explain myself...

this is the broadcast.lua i have for that command

Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ";")
	if(not t[2]) then
		doBroadcastMessage(t[1])
	elseif(not doBroadcastMessage(t[2], MESSAGE_TYPES[t[1]])) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bad message color type.")
	end

	return true
end
 
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	local t = string.explode(param, ";")
	if(not t[2]) then
		doBroadcastMessage(t[1])
	elseif(not doBroadcastMessage(t[2], MESSAGE_TYPES[t[1]])) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bad message color type.")
	end

	return true
end
 
Lua:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local t = string.explode(param, ";")
    if(not t[2]) then
        doBroadcastMessage(t[1])
    elseif(not doBroadcastMessage(t[2], MESSAGE_TYPES[t[1]])) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bad message color type.")
    end

    return true
end

You haven't changed anything in the script at all, trolling much? :rolleyes:
 
:D ok thanks

- - - Updated - - -

Sorry it didn't work, now i'm getting this error
Lua:
[01/04/2013 18:41:37] [Error - LuaScriptInterface::loadFile] data/talkactions/scripts/broadcastclass.lua:9: ')' expected near 't'
[01/04/2013 18:41:37] [Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/broadcastclass.lua)
[01/04/2013 18:41:37] data/talkactions/scripts/broadcastclass.lua:9: ')' expected near 't'

and this is what i have in talkactions:

Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
 
	local t = string.explode(param, ";")
	if(not t[2]) then
		doBroadcastMessage(getPlayerName(cid).." says: "t[1])
	elseif(not doBroadcastMessage(t[2], MESSAGE_TYPES[t[1]])) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bad message color type.")
	end
 
	return true
end
 
Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end
 
	local t = string.explode(param, ";")
	if(not t[2]) then
		doBroadcastMessage(getPlayerName(cid).." says: "..t[1])
	elseif(not doBroadcastMessage(t[2], MESSAGE_TYPES[t[1]])) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Bad message color type.")
	end
 
	return true
end
my bad..
 
Replace
Lua:
doBroadcastMessage(t[1])
with
Lua:
doBroadcastMessage(getPlayerName(cid).." says: "..t[1])
worked i was looking this for tutors on my server thanks !

do u have a code for tutors to tp and go to players? because gm edited for tutors doesnt works for me :C

regards
 
worked i was looking this for tutors on my server thanks !

do u have a code for tutors to tp and go to players? because gm edited for tutors doesnt works for me :C

regards

Post the one you currently have, and the xml just incase it has something to do with it.
 
thanks for your reply @Bogart
TP command /tp
Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local creature = getCreatureByName(param)
    local player = getPlayerByNameWildcard(param)
    local waypoint = getWaypointPosition(param)
    local tile = string.explode(param, ",")
    local pos = {x = 0, y = 0, z = 0}

    if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
        pos = getCreaturePosition(player)
    elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then
        pos = getCreaturePosition(creature)
    elseif(isInArray({'back', 'last'}, param:lower())) then
        pos = getCreatureLastPosition(cid)
    elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then
        pos = waypoint
    elseif(tile[2] and tile[3]) then
        pos = {x = tile[1], y = tile[2], z = tile[3]}
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
        return true
    end

    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
        return true
    end

    pos = getClosestFreeTile(cid, pos, true, false)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
        return true
    end

    local tmp = getCreaturePosition(cid)
    if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
    end

    return true
end

bring player to gm /c

Code:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
        return true
    end

    local target = getPlayerByNameWildcard(param)
    if(not target) then
        target = getCreatureByName(param)
        if(not target) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
            return true
        end
    end

    if(isPlayerGhost(target) and getPlayerGhostAccess(target) > getPlayerGhostAccess(cid)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Creature not found.")
        return true
    end

    local pos = getClosestFreeTile(target, getCreaturePosition(cid), false, false)
    if(not pos or isInArray({pos.x, pos.y}, 0)) then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
        return true
    end

    local tmp = getCreaturePosition(target)
    if(doTeleportThing(target, pos, true) and not isPlayerGhost(target)) then
        doSendMagicEffect(tmp, CONST_ME_POFF)
        doSendMagicEffect(pos, CONST_ME_TELEPORT)
    end

    return true
end

groups.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<groups>
    <group id="1" name="Player"/>
    <group id="2" access="1" name="Tutor" flags="137455730688" customFlags="2"/>
    <group id="3" access="2" name="Senior Tutor" flags="137455730688" customFlags="2"/>
    <group id="4" access="3" name="God" flags="57172457136122" customFlags="67108863" violationReasons="23" nameViolationFlags="426" statementViolationFlags="469"/>
</groups>

i use otx2 772 based on tfs 0.3.7

the problem is that seniors tutors haven0t commands as gms have
 
@Bogart
Code:
<?xml version="1.0" encoding="UTF-8"?>
<talkactions>
    <!-- Community Managers -->
    <talkaction log="yes" group="4" access="3" words="/addskill;/upgrade" event="script" value="skill.lua"/>
    <talkaction log="yes" group="4" access="3" words="/attr;/edition" event="function" value="thingProporties"/>
    <talkaction log="yes" group="4" access="3" words="/serverdiag" event="function" value="diagnostics"/>
    <talkaction log="yes" group="4" access="3" words="/closeserver;/openserver" event="script" value="closeopen.lua"/>
    <talkaction log="yes" group="4" access="3" words="/promote;/demote" event="script" value="promote.lua"/>
    <talkaction log="yes" group="4" access="3" words="/shutdown" event="script" value="shutdown.lua"/>
    <talkaction log="yes" group="4" access="3" words="/mode" event="script" value="mode.lua"/>
    <talkaction log="yes" group="4" access="3" words="/m;/monster;/n;/npc" event="script" value="creature.lua"/>
    <talkaction log="yes" group="4" access="3" words="/i;/objetos;/items" event="script" value="createitem.lua"/>
    <talkaction log="yes" group="4" access="3" words="/s;/summon" event="script" value="summon.lua"/>
    <talkaction log="yes" group="4" access="3" words="/storage" event="script" value="storage.lua"/>
    <talkaction log="yes" group="4" access="3" words="/config" event="script" value="configinfo.lua"/>
    <talkaction log="yes" group="4" access="3" words="/mkick" event="script" value="masskick.lua"/>
    <talkaction log="yes" group="4" access="3" words="/owner" event="script" value="owner.lua"/>
    <talkaction log="yes" group="4" access="3" words="/save" event="script" value="save.lua"/>
    <talkaction log="yes" group="4" access="3" words="/b" event="script" value="broadcast.lua"/>
    <talkaction log="yes" group="4" access="3" words="/bc" event="script" value="broadcastclass.lua"/>
    <talkaction log="yes" group="4" access="3" words="/unban" event="script" value="unban.lua"/>
    <talkaction log="yes" group="4" access="3" words="/raid" event="script" value="raid.lua"/>
    <talkaction log="yes" group="4" access="3" words="/newtype" event="script" value="newtype.lua"/>
    <talkaction log="yes" group="4" access="3" words="/send" event="script" value="teleportsend.lua"/>
    <talkaction log="yes" group="4" access="3" words="/wp" event="script" value="waypoints.lua"/>
    <talkaction log="yes" group="4" access="3" words="/r;/remove" event="script" value="remove.lua"/>
    <talkaction log="yes" group="4" access="3" words="/c" event="script" value="teleporthere.lua"/>
    <talkaction log="yes" group="4" access="3" words="/kick" event="script" value="kick.lua"/>
    <talkaction log="yes" group="4" access="3" words="/reload" event="script" value="reload.lua"/>
    <talkaction log="yes" group="4" access="3" words="/up;/down" event="script" value="teleportfloor.lua"/>
    <talkaction log="yes" group="4" access="3" words="/clean" event="script" value="clean.lua"/>
    <talkaction log="yes" group="4" access="3" words="/town" event="script" value="teleporttown.lua"/>
    <talkaction log="yes" group="4" access="3" words="/info" event="script" value="playerinfo.lua"/>
    <talkaction log="yes" group="4" access="3" words="/cliport;/squelch" event="script" value="gamemaster.lua"/>
    <talkaction log="yes" group="4" access="3" words="/ghost;/invisible" event="function" value="ghost"/>
    <talkaction log="yes" group="4" access="3" words="/mute;/unmute" event="script" value="mute.lua"/>
    <talkaction log="yes" group="4" access="3" words="/light" event="script" value="gamemaster.lua"/>
    <talkaction log="yes" group="4" access="3" words="/notations" event="script" value="notations.lua"/>
    <talkaction log="yes" group="4" access="3" words="/goto;!goto" event="script" value="teleportto.lua"/>
    <talkaction log="yes" group="4" access="3" words="/baninfo" event="function" value="banishmentInfo"/>
    <talkaction log="yes" group="4" access="3" words="/tp;!tp" event="script" value="gmtp.lua"/>

    <!-- SENIOR TUTORS -->
    <talkaction group="3" access="2" words="/bct;!bct" event="script" value="broadcasttutor.lua"/>

    <!-- Players -->
    <talkaction access="0-4" words="!frags;/frags" event="script" value="frags.lua"/>
    <talkaction access="0-4" words="!online;/online" event="script" value="online.lua"/>
    <talkaction access="0-4" words="!uptime;/uptime" event="script" value="uptime.lua"/>
    <!-- <talkaction access="0-4" words="!serverinfo;/serverinfo" event="script" value="serverinfo.lua"/> -->
    <talkaction access="0-4" words="!commands;/commands" event="script" value="commands.lua"/>
    <talkaction access="0-4" words="!pvp;/pvp" event="script" value="pvp.lua"/>
    <!-- <talkaction access="0-4" words="/software;!software" event="function" value="software"/> -->
    <talkaction access="0-4" words="!stamina;/stamina" event="script" value="stamina.lua"/>
    <talkaction access="0-4" words="!share;/share" event="script" value="partyshareexp.lua"/>

    <!-- Houses -->
    <talkaction access="0-4" words="alana res;/buyhouse" filter="word-spaced" event="function" value="houseBuy"/>
    <talkaction access="0-4" words="alana grav;/sellhouse" filter="word-spaced" event="function" value="houseSell"/>
    <talkaction access="0-4" words="alana sio" filter="word-spaced" event="function" value="houseKick"/>
    <talkaction access="0-4" words="aleta grav" filter="word-spaced" event="function" value="houseDoorList"/>
    <talkaction access="0-4" words="aleta sio" filter="word-spaced" event="function" value="houseGuestList"/>
    <talkaction access="0-4" words="aleta som" filter="word-spaced" event="function" value="houseSubOwnerList"/>
    <talkaction access="0-4" words="alana som;/leavehouse" filter="word-spaced" event="script" value="leavehouse.lua"/>

    <!-- Guilds -->
    <talkaction access="0-4" words="!createguild;/createguild" event="function" value="guildCreate"/>
    <talkaction access="0-4" words="!joinguild;/joinguild" event="function" value="guildJoin"/>
    <talkaction access="0-4" words="/war" channel="0" event="script" value="war.lua"/>
    <talkaction access="0-4" words="/balance" channel="0" event="script" value="balance.lua"/>
</talkactions>
 
Back
Top