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

Need help with script

Erexo

Kage
Premium User
Joined
Mar 27, 2010
Messages
743
Solutions
5
Reaction score
200
Location
Pr0land
GitHub
Erexo
Hello,
i just write that script:
LUA:
function onThink(cid, interval)
	if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 7426 then
		if not getPlayerStorageValue(cid,1639) == 2 then
			setPlayerStorageValue(cid,1639,2)
		end
	else
		if not getPlayerStorageValue(cid,1639) == 1 then
			setPlayerStorageValue(cid,1639,1)
		end
	
	end
return TRUE
end

and that wont working...
i wanna, when player have item with id 7426 equipped on necklace pleace he have stroage 1639 == 2, and when he take out that necklace he back to 1639 == 1. Someone can help with that script? (my goal is, when player equppied an necklace then send magic effects one per second, but when take out magic effects dissapeared).

Thanks for any help,
Erexo :)
 
LUA:
function onThink(cid, interval)
local config = {
			itemID = 7426,
			slot = CONST_SLOT_NECKLACE
		}

for _, cid in ipairs(getPlayersOnline()) do
	if getPlayerSlotItem(cid, config.slot).itemid == config.itemID then
		if getPlayerStorageValue(cid, 1639) < 2 then
			setPlayerStorageValue(cid, 1639, 2)
	else
	setPlayerStorageValue(cid, 1639, 1)
	return true
		end
	end
end
 
No need to loop for every player, just do it onEquip and onDeEquip
LUA:
function onEquip(cid)
return setPlayerStorageValue(cid,2)
end

function onDeEquip(cid)
return setPlayerStorageValue(cid,1)
end
 
No need to loop for every player, just do it onEquip and onDeEquip
LUA:
function onEquip(cid)
return setPlayerStorageValue(cid,2)
end

function onDeEquip(cid)
return setPlayerStorageValue(cid,1)
end


What if they die and drop it? Or is that the same as deequiping?
 
Ok, thanks for help i do that :)


I have next problem,
i need script, when player use item with id 3500, and this item have description "20/20" then add item with id 3501 and set description to "19/20", and when description is "0/20" you cannot use that item.

Someone can? :)
 
Last edited:
Back
Top