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

Weapon

Biozards

New Member
Joined
Sep 29, 2011
Messages
10
Reaction score
0
how do I check if you have sword in right hand or in left hand, if he has not, send a message to the player.
 
This is copied from serverfolder/doc/LUA_FUNCTIONS
Code:
			getPlayerSlotItem(cid, slot)
				Info
					This function checks what item player have actually in slot.
					Slot can be:
					CONST_SLOT_HEAD (1) = helmet
					CONST_SLOT_NECKLACE (2) = necklace slot (amulet of loss etc.)
					CONST_SLOT_BACKPACK (3) = backpack, bag
					CONST_SLOT_ARMOR (4) = armor
					CONST_SLOT_LEFT (5) = left hand (its really hand placed >> (right page on screen))
					CONST_SLOT_RIGHT (6) = right hand (its really hand placed << (left page on screen))
					CONST_SLOT_LEGS (7) = legs
					CONST_SLOT_FEET (8) = boots
					CONST_SLOT_RING (9) = ring slot
					CONST_SLOT_AMMO (10) = ammo slot (arrows etc.)

				Returns
					Array with item which is actually in slot. When slot is empty, then returns false
						For Example:
							{itemid = 2493, uid = 70001, actionid = 0} (demon helmet, slot = 1)

				Example
					if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2173 then  --checking if player have amulet of loss in necklace slot
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Ok, you can go.")
					else
						doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, you need amulet of loss to go.")
						doTeleportThing(cid, fromPosition, TRUE)
					end

I hope it helps.
 
This to check if the item is weapon
Lua:
function isWeapon(uid) -- Function by Mock the bear.
         uid = uid or 0
         local f = getItemWeaponType(uid)
         if f == 1 or f == 2 or f == 3 then
             return TRUE
         end
         return FALSE         
end
Lua:
isWeapon(getPlayerSlotItem(cid, CONST_SLOT_LEFT).uid) or isWeapon(getPlayerSlotItem(cid, CONST_SLOT_RIGHT).uid)
 
I tried here but could not what I wanted.
I wanted, that X vocation is be able to equip two weapons.

I edited the source to equip two weapons.
 
Back
Top