• 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 Help me fix this script

Crip Killa

♪Chasm Dev♪
Joined
Oct 19, 2008
Messages
515
Reaction score
44
I get this error with this script and I have no idea how to fix i'm using TFS 0.3.6 would really appreciate the help

[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/hitmsg.lua:1: '=' expected near 'function'

Code:
onStatsChange function (cid, attacker, type, combat, value) 
place = 25 chance - here and in 25% chance of this working 
place tabble = { 
[1] = {max = 15, msg = "Lower"}, 
[16 ] = {max = 50, msg = "Good"}, 
[51] = {max = 100, msg = "Mega"}, 
[101] = {max = 250, msg = "Epic"}, 
[251] = {max = 300, msg = "Perfect"}, 
[301] = {max = 600, msg = "Supreme"}, 
[601] = {max = 2000, msg = "Divine"}, 
[2001] = max { = 100000, msg = "Hs"} 
} if type == STATSCHANGE_HEALTHLOSS and isPlayer (attacker) then if (odds> math.random (1, 100)) then if value == 0 then doSendAnimatedText (getCreaturePosition (attacker), "MISS ", math.random (1,255)) else is min, hit in pairs (tabble) of if value> = min and value <= hit.max then place color = math.random (1,255) doSendAnimatedText (getCreaturePosition (attacker), hit . msg, color) pos2 = Local "HIT", color) end end end end elseif type == STATSCHANGE_HEALTHGAIN then return false end return true end function onCombat (cid, target) registerCreatureEvent (target, "HitMessage") return true end
 
Lua:
onStatsChange function (cid, attacker, type, combat, value) 
place = 25 chance - here and in 25% chance of this working 
place tabble = { 
[1] = {max = 15, msg = "Lower"}, 
[16 ] = {max = 50, msg = "Good"}, 
[51] = {max = 100, msg = "Mega"}, 
[101] = {max = 250, msg = "Epic"}, 
[251] = {max = 300, msg = "Perfect"}, 
[301] = {max = 600, msg = "Supreme"}, 
[601] = {max = 2000, msg = "Divine"}, 
[2001] = max { = 100000, msg = "Hs"} 
} if type == STATSCHANGE_HEALTHLOSS and isPlayer (attacker) then if (odds> math.random (1, 100)) 
then if value == 0 then doSendAnimatedText (getCreaturePosition (attacker), "MISS ", math.random (1,255))
else is min, hit in pairs (tabble) of if value> = min and value <= hit.max then place color = math.random (1,255)
doSendAnimatedText (getCreaturePosition (attacker), hit . msg, color) pos2 = Local "HIT", color)
end end end end elseif type == STATSCHANGE_HEALTHGAIN then
function onCombat (cid, target)
registerCreatureEvent (target, "HitMessage")
return true
end
 
Thanks for trying rox666 I still get the same error

[Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/hitmsg.lua:1: '=' expected near 'function'
 
Last edited:
Lua:
function onStatsChange(cid, attacker, type, combat, value)
local chance = 25 
local tabble = {
[1] = {max = 15,msg = "Lower"},
[16] = {max= 50,msg = "Good"},
[51] = {max= 100,msg = "Mega"},
[101] = {max= 250,msg = "Epic"},
[251] = {max= 300,msg = "Perfect"},
[301] = {max= 600,msg = "Supreme"},
[601] = {max= 2000,msg = "Divine"},
[2001] = {max= 100000,msg = "Hs"}
}

if type == STATSCHANGE_HEALTHLOSS and isPlayer(attacker) then

if (chance > math.random(1, 100)) then
if value == 0 then
doSendAnimatedText(getCreaturePosition(attacker), "MISS", math.random(1,255))
else
for min, hit in pairs(tabble) do
if value >= min and value <= hit.max then
local color = math.random(1,255)
doSendAnimatedText(getCreaturePosition(attacker), hit.msg, color)
local pos2 = {x=getCreaturePosition(attacker).x+1,y=getCreaturePosition(attacker).y,z=getCreaturePosition(attacker).z}
doSendAnimatedText(pos2, "HIT", color)
end
end
end
end
elseif type == STATSCHANGE_HEALTHGAIN then
return false
end
return true
end
function onCombat(cid, target)
registerCreatureEvent(target, "HitMessage")
return true
end
 
Back
Top Bottom