• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Request Roll System

andre66

Banned User
Joined
Oct 27, 2008
Messages
295
Reaction score
0
Alright, i want a script wich makes like WoW you need to roll the item.


Like there is a party 10 people. a rare thing drops! And if more than 1 need it they need to roll the item.












+rep
 
So you mean u can't make a talkaction wich makes so.

Someone says /roll it gives a randomly number between 1-100 ? o_O
 
its very easy to do and it has nothing to do with loot its just a talkaction that replies with math.random(1,100)

I havn't done any talkaction scripts so can't help you
 
Alright, well!

There should be anyone who can do this simple script ?


Please!
 
<talkaction access="0" log="no" filter="word" words="!roll" script="roll.lua" />



Lua:
function onSay(cid, words, param)

local party = getPartyMembers(getPlayerParty(cid))

	for _,pid in ipairs(party) do
		doPlayerSendChannelMessage(pid, "", getPlayerName(pid) .. " rolls " .. math.random(1,100), TALKTYPE_CHANNEL_W, CHANNEL_DEFAULT)
	end

return true
end

I didn't test this and I don't know the party functions so this will probably not work!
 
Last edited:
<talkaction access="0" log="no" filter="word" words="!roll" script="roll.lua" />



Lua:
function onSay(cid, words, param)

local party = getPartyMembers(getPlayerParty(cid))

	for _,pid in ipairs(party) do
		doPlayerSendChannelMessage(pid, "", getPlayerName(pid) .. " rolls " .. math.random(1,100), TALKTYPE_CHANNEL_W, CHANNEL_DEFAULT)
	end

return true
end

I didn't test this and I don't know the party functions so this will probably not work!

will it add like a "RED" text over the character wich a number ?

Like a dice
 
You still haven't even fully described what the script is supposed to do, someone even offered to help if you told them, but you just spammed bump. Also, this is the wrong section for requests
 
You still haven't even fully described what the script is supposed to do, someone even offered to help if you told them, but you just spammed bump. Also, this is the wrong section for requests

Rolf.


I want a "TALKACTION" as you can read on the topic!

When someone says !roll a number between 1-100 (randomly) and a text going to pop up over the character where it says "You got number 64" example! And would be good if the character only could say this each 10 second!
 
Code:
local cfg = {
	randSize = 100,
	exhaustStorage = 30000,
	exhaustSeconds = 10
}
function onSay(cid, words, param, channel)
return 
	os.difftime(os.time(), getPlayerStorageValue(cid, cfg.exhaustStorage)) >= cfg.exhaustSeconds and
		doCreatureSay(cid, "You got number ".. math.random(cfg.randSize) .."!", TALKTYPE_ORANGE_1) and
		setPlayerStorageValue(cid, cfg.exhaustStorage, os.time())
	or
		doPlayerSendCancel(cid, "You can only use this command once every ".. cfg.exhaustSeconds .." seconds.")
end
 
@up, you made a small mistake, remove "return".

<talkaction access="0" log="no" filter="word" words="!roll" script="roll.lua" />



Lua:
function onSay(cid, words, param)

local party = getPartyMembers(getPlayerParty(cid))

	for _,pid in ipairs(party) do
		doPlayerSendChannelMessage(pid, "", getPlayerName(pid) .. " rolls " .. math.random(1,100), TALKTYPE_CHANNEL_W, CHANNEL_DEFAULT)
	end

return true
end

I didn't test this and I don't know the party functions so this will probably not work!

Wrong, that will give different values for each member. Also, you are using the wrong function to send the rolling message.

This should be the correct one:
Lua:
function onSay(cid, words, param)
	local party = getPartyMembers(getPlayerParty(cid))
	local randomvalue = math.random(1,100)
    for _,pid in ipairs(party) do
        doPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_RED, getPlayerName(pid) .. " rolls " .. randomvalue .. ".")
    end
	return true
end

You still haven't even fully described what the script is supposed to do, someone even offered to help if you told them, but you just spammed bump. Also, this is the wrong section for requests

When the script is executed by a player, all party members will get a message like: "Noob rolls 24."
 
Code:
local cfg = {
	randSize = 100,
	exhaustStorage = 30000,
	exhaustSeconds = 10
}
function onSay(cid, words, param, channel)
return 
	os.difftime(os.time(), getPlayerStorageValue(cid, cfg.exhaustStorage)) >= cfg.exhaustSeconds and
		doCreatureSay(cid, "You got number ".. math.random(cfg.randSize) .."!", TALKTYPE_ORANGE_1) and
		setPlayerStorageValue(cid, cfg.exhaustStorage, os.time())
	or
		doPlayerSendCancel(cid, "You can only use this command once every ".. cfg.exhaustSeconds .." seconds.")
end

Works perfectly thanks ! <3
 
Back
Top