• 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 How to fix this script? Rep+

brunolopes

New Member
Joined
Nov 8, 2009
Messages
49
Reaction score
1
Can someone help me?

I was making a "advanced convince" for my server with tables, for example:

Code:
local bribes = {
	["Rat"] = {
		money = 5,
		item = "Cheese",
		chances = {1, 100000}
	},
	["Demon"] = {
		money = 100000,
		item = "Demon Shield",
		chances = {80000, 5000}
	}
}

But when I use a in pairs function, the script compares all the monster names with the target.

Code:
local target = getCreatureTarget(cid)

for m, n in pairs(bribes) do
   if(getCreatureName(target) == m) then
      doConvinceCreature(cid, target)
   else
      doPlayerSendCancel(cid, "This is not a bribeable creature")
   end
end

So the script convinces the creature and sends the player's cancel.

How I can fix this?
 
Back
Top