• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Switch system II

Eternal Life

New Member
Joined
May 15, 2011
Messages
148
Reaction score
1
Location
Aguadilla,Puerto Rico
Guys Ihave this script:

function getPlayerMoney(cid)
gold = getPlayerItemCount(cid,2148)
plat = getPlayerItemCount(cid,2152)*100
crys = getPlayerItemCount(cid,2160)*10000
money = gold + plat + crys
return money
end

function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerMoney(cid) >= 10000 then
doPlayerRemoveMoney(cid,10000)
doPlayerAddItem(cid,2173,1)
doSendMagicEffect(getPlayerPosition(cid), 13)
else
doPlayerSendTextMessage(cid,19,"Sorry but you need 1 crystal coin to buy an aol.")
doSendMagicEffect(getPlayerPosition(cid), 2)
end
return TRUE
end

What it does is that when i right click a switch it gives me and aol for 1crystal coin. So for the real reason why am posting this is becouse i want you to edit the script to work with items instead of money. Its for my vip switch system. This is what i wantit to do: When i click on the switch it takes away this item id(5887) [it is a pice of royal steel] and it gives me an item like this item id(2300) [it is a Vip Uh]
 
LUA:
local t = {
      a = 5887, -- Piece of royal steel
      b = 1, -- how many pieces of royal steel to be removed
      c = 2300 -- VIP UH
}
function onUse(cid, item, frompos, item2, topos)
if doPlayerRemoveItem(cid, t.a, t.b) then
   doPlayerAddItem(cid, t.c)
   else
   doPlayerSendCancel(cid, "You need atleast "..t.b.." Pieces of royal steel")
   end
return TRUE
end
 
LUA:
local t = {
      a = 5887, -- Piece of royal steel
      b = 1, -- how many pieces of royal steel to be removed
      c = 2300, -- VIP UH
      d = 1
}
function onUse(cid, item, frompos, item2, topos)
if doPlayerRemoveItem(cid, t.a, t.b) then
   doPlayerAddItem(cid, t.c, t.d)
   else
   doPlayerSendCancel(cid, "You need atleast "..t.b.." Pieces of royal steel")
   end
return TRUE
end
 
LUA:
local t = {
      a = 5887, -- Piece of royal steel
      b = 1, -- how many pieces of royal steel to be removed
      c = 2300, -- VIP UH
      d = 1
}
function onUse(cid, item, frompos, item2, topos)
   if doPlayerRemoveItem(cid, t.a, t.b) then
      doPlayerAddItem(cid, t.c, t.d)
      doSendAnimatedText(getThingPosition(cid), "UH", math.random(01,255))
         else
         doPlayerSendCancel(cid, "You need atleast "..t.b.." Pieces of royal steel")
   end
return TRUE
end
 
Oh and i got 1 more thing i want the same thing on my vip uh script:

local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 29)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
--setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.3, -30, 1.7, 0)

function onGetFormulaValues(cid, level, maglevel)
min = (level * 2 + maglevel * 3) * 2.3 - 25
max = (level * 2 + maglevel * 3) * 2.6

if min < 7500 then
min = 7500
end

return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
return doCombat(cid, combat, var)
end

When i use it i want it to say 7500+ on top of the player
 
Long time I since I last scripted anything...let's see now if I still remember...

vip_uh_switch.lua:
LUA:
local VIP_UH_SWITCH = {
	object = {5887, 1} -- Piece of royal steel/Pieces to be removed
	uh = {2300, 1} -- VIP UH/Amount
	text = {"UH"} -- Text
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerItemCount(cid, VIP_UH_SWITCH.object[1]) >= VIP_UH_SWITCH.object[2]) then
		doPlayerRemoveItem(cid, VIP_UH_SWITCH.object[1], VIP_UH_SWITCH.object[2])
		doPlayerAddItem(cid, VIP_UH_SWITCH.uh[1], VIP_UH_SWITCH.uh[2])
		doSendAnimatedText(getThingPosition(cid), VIP_UH_SWITCH.text[1], math.random(255))
	else
		doPlayerSendCancel(cid, "You need at least " .. VIP_UH_SWITCH.object[2] .. " piece" .. (VIP_UH_SWITCH.object[2] > 1 and "s" or "") .. " of royal steel.")
	end
 
	return true
end

vip_uh.lua:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 29)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
--setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.3, -30, 1.7, 0)

function onGetFormulaValues(cid, level, maglevel)
	min = (level * 2 + maglevel * 3) * 2.3 - 25
	max = (level * 2 + maglevel * 3) * 2.6
	if min < 7500 then
		min = 7500
	end

	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	return doSendAnimatedText(getThingPosition(cid), "7500+", math.random(255)) and doCombat(cid, combat, var)
end
 
Last edited:
Long time I since I last scripted anything...let's see now if I still remember...

vip_uh_switch.lua:
LUA:
local VIP_UH_SWITCH = {
	object = {5887, 1} -- Piece of royal steel/Pieces to be removed
	uh = {2300, 1} -- VIP UH/Amount
	text = {"UH"} -- Text
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(getPlayerItemCount(cid, VIP_UH_SWITCH.object[1]) >= VIP_UH_SWITCH.object[2]) then
		doPlayerRemoveItem(cid, VIP_UH_SWITCH.object[1], VIP_UH_SWITCH.object[2])
		doPlayerAddItem(cid, VIP_UH_SWITCH.uh[1], VIP_UH_SWITCH.uh[2])
		doSendAnimatedText(getThingPosition(cid), VIP_UH_SWITCH.text[1], math.random(255))
	else
		doPlayerSendCancel(cid, "You need at least " .. VIP_UH_SWITCH.object[2] .. " piece" .. (VIP_UH_SWITCH.object[2] > 1 and "s" or "") .. " of royal steel")
	end
 
	return true
end

vip_uh.lua:
LUA:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, 29)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, 1)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, 0)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_PARALYZE)
--setCombatFormula(combat, COMBAT_FORMULA_LEVELMAGIC, 1.3, -30, 1.7, 0)

function onGetFormulaValues(cid, level, maglevel)
	min = (level * 2 + maglevel * 3) * 2.3 - 25
	max = (level * 2 + maglevel * 3) * 2.6
	if min < 7500 then
		min = 7500
	end

	return min, max
end

setCombatCallback(combat, CALLBACK_PARAM_LEVELMAGICVALUE, "onGetFormulaValues")

function onCastSpell(cid, var)
	return doSendAnimatedText(getThingPosition(cid), "7500+", math.random(255)) and doCombat(cid, combat, var)
end

Pro.
 

Similar threads

Back
Top