• 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] need help

televolt

Member
Joined
Jun 21, 2010
Messages
153
Reaction score
9
Problem solved ^^
this script checks what weapon is equiped on right hand and will block attacks..
otx 2.7 or tfs 0.3.7

Code:
function onTarget(cid, target)
if getPlayerSlotItem(cid, 5).itemid > 0 then
local v = getPlayerSlotItem(cid, 5)
if getPlayerVocation(cid) ~= 9 and getItemWeaponType(v.uid) == 1 then
doPlayerSendCancel(cid, "You can't attack while you're wielding two swords.")
return false
end
end
return true
end
 
Last edited:
Code:
function onTarget(cid, target)
if getPlayerSlotItem(cid, 6).itemid > 0 then
local v = getPlayerSlotItem(cid, 6)
if getPlayerVocation(cid) ~= 9 and getItemWeaponType(v.uid) == 1 then
return false
end
end
return true
end
You are getting that error because the Player doesn't have an item in that Slot, so you need to verify first if there is something in the Players hand.
 
Back
Top