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

some commands will not work

Powtreeman

Member
Joined
Sep 26, 2011
Messages
400
Reaction score
6
Location
USA
i cant get /commands or /promote to work.

i have this in talkactions

<talkaction words="/promote;/demote" script="promote.lua"/>
<talkaction words="!commands;/commands" event="script" value="commands.lua"/>


just foudn out the post i found with the /commands script wasnt even a commands script it was a createguild script..... that explains why that one doesnt work but here is my promote script


Lua:
local config = {
	broadcast = false
}

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, ",", 1)
	local pid = getPlayerByNameWildcard(t[1])
	if(not pid) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[1] .. " not found.")
		return true
	end

	if(getPlayerAccess(pid) >= getPlayerAccess(cid)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local g, group = 1, getPlayerGroupId(pid)
	if(words:sub(2, 2) == "d") then
		g = -1
	end

	local newGroup = group + g
	if(t[2] ~= nil) then
		for i, id in ipairs(getGroupList()) do
			local tmp = getGroupInfo(id)
			if(isInArray({tmp.id, tmp.name}, t[2])) then
				newGroup = id
				break
			end
		end
	end

	if(newGroup <= 0 or newGroup == group or not setPlayerGroupId(pid, newGroup)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local str = "been " .. (group < newGroup and "promoted" or "demoted") .. " to " .. getGroupInfo(newGroup).name .. "."
	if(not config.broadcast) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, param .. " has " .. str)
	else
		doBroadcastMessage(param .. " has " .. str, MESSAGE_EVENT_ADVANCE)
	end

	doPlayerSendTextMessage(pid, MESSAGE_EVENT_ADVANCE, "You have " .. str)
	return true
end
 
Last edited by a moderator:
yes this.



[25/07/2013 15:05:19] Lua Script Error: [TalkAction Interface]
[25/07/2013 15:05:19] data/talkactions/scripts/promote.lua:eek:nSay
[25/07/2013 15:05:19] data/talkactions/scripts/promote.lua:12: attempt to call global 'getPlayerByNameWildcard' (a nil value)
[25/07/2013 15:05:19] stack traceback:
[25/07/2013 15:05:19] [C]: in function 'getPlayerByNameWildcard'
[25/07/2013 15:05:19] data/talkactions/scripts/promote.lua:12: in function <data/talkactions/scripts/promote.lua:5>
 
getplayerbyname one works i think but now it says in game

20:42 Cannot perform action.
i have it in talk actions like this

<talkaction words="/promote" script="promote.lua"/>
<talkaction words="/demote" script="promote.lua"/>

I tried putting it in commands.xml too like this

<command cmd="/promote" group="5" acctype="1" log="yes"/>
<command cmd="/demote" group="5" acctype="1" log="yes"/>

but it shows in console

[25/07/2013 20:42:12] Unknown command /promote
[25/07/2013 20:42:12] Unknown command /demote
[25/07/2013 20:42:12] Unknown command !commands

- - - Updated - - -

i got all commands to be more responsive with ! instead of / but i need the script now.
another thing i need is to know how to tag things as lua like
Lua:
  something something

oh i guess thats it. annoying to type it in but it does make it look better
 
Last edited:
getplayerbyname one works i think but now it says in game

20:42 Cannot perform action.
i have it in talk actions like this

<talkaction words="/promote" script="promote.lua"/>
<talkaction words="/demote" script="promote.lua"/>

I tried putting it in commands.xml too like this

<command cmd="/promote" group="5" acctype="1" log="yes"/>
<command cmd="/demote" group="5" acctype="1" log="yes"/>

but it shows in console

[25/07/2013 20:42:12] Unknown command /promote
[25/07/2013 20:42:12] Unknown command /demote
[25/07/2013 20:42:12] Unknown command !commands

- - - Updated - - -

i got all commands to be more responsive with ! instead of / but i need the script now.
another thing i need is to know how to tag things as lua like
Lua:
  something something

oh i guess thats it. annoying to type it in but it does make it look better

Try change group="5" to access="5"
 
still says 15:54 Cannot perform action.

but it looks like its trying to work. no errors in console

- - - Updated - - -

something in actions maybe?
 
Back
Top