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

help needed please look :P

izaak

New Member
Joined
Feb 1, 2009
Messages
161
Reaction score
3
i have a questions and i hope u guys can give me a few examples

how do i request a slot id like

if an item is inside the head slot
i really need this i have bin trying allot of diffrent type of requests but they all dont work.
 
LUA:
if getPlayerSlotItem(cid,CONST_SLOT_HEAD).uid > 0 then  ---This to check if there is an item there

if getPlayerSlotItem(cid,CONST_SLOT_HEAD).itemid == 2256 then   -- This to check if the item in head slot is math with that itemid
 
This like returns the thing itself (like a value used to check-I think it is like cid for players) , so if you want to check,get thing from a pos, or get anything value, you use .uid

Examples :

1- i need to check if there is item in a place so as the script to remove it, and if there isnt then not to show errors
LUA:
local pos =  -- the checked postion for the thing

--If i used <<getThingFromPos>>
local get = getThingFromPos(pos)

-- now to check for the uid if exist[the item/or creature there]

if get.uid > 0 then  -- so this line checks if there is somthng there else we should use <0 to check if there isnt a thing there

--further more after we checked if there is a thing there we need to specify so use
if get.itemid == 1387


doRemoveItem(get.uid)  --so this will remove the teleport 

--check if isplayer there anyplayer not a definite one

if isPlayer(get.uid) then

At least that is how i know it :p
 
It returns uid, but in this case you don't need it at all. You already check if it has .itemid == x, then you don't need to check uid too....
 
no not in the requested either... it's enough with this:
if getPlayerSlotItem(cid,CONST_SLOT_HEAD).itemid == 2256 then
 
As far as i got it : No it isnt, he didnt said he want to check if this item is tehre he said he want to check if there is item there


And this should be = If slot is empty or have item , and this wont be with .itemid
 
REP ++ added to u both , it works haha thank you xD

i made the code like this

if getPlayerSlotItem(cid,CONST_SLOT_HEAD).itemid == 0 then

this way it checks all the item id's now when its empty it dous what i want it to do hehe..
 
Last edited:
1 more question :P i have made it so when i click my steel helmet that it adds me a steel helmet in my headslot , but i cant get it to remove the one in my backpack.
this is what i have sofar.

Code:
function onUse (cid, item, frompos, topos)
if getPlayerSlotItem(cid,CONST_SLOT_HEAD).itemid == 0 then
doPlayerGiveItem (cid,2457,1,CONST_SLOT_HEAD,1)
end
end

>>>> never mind i got it to work hehe
 
Last edited:
thank you xD its working i have step 1 of a complete new equiptment system now xD

Code:
function onUse (cid, item, frompos, topos)
if getPlayerSlotItem(cid,CONST_SLOT_HEAD).uid == 0 then
if doPlayerTakeItem(cid,2457,1,CONST_SLOT_BACKPACK,1) == true
then doPlayerGiveItem(cid,2457,1,CONST_SLOT_HEAD,1)
return true
end
else
if getPlayerSlotItem(cid,CONST_SLOT_HEAD).itemid == 2457 then
doPlayerSendCancel(cid, "You already have a steel helmet equipted.")
		return false
	end
end
end

this puts my steel helmet in headslot from backpack haha
im gonna try to fix this with all the equiptment and also weapons
because i hate dragging equiptments in and out hehe
 
Back
Top