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

CreatureEvent Automatic AOL buyer

Rodo

New Member
Joined
Oct 23, 2007
Messages
575
Solutions
1
Reaction score
3
Location
Mexico
With this script, players will be able to buy an amulet of loss automatically when they die just using the comand /aol on, /aol off


¿Does this system is really usefull?

Yes!, you don't lose your time going to shop tu buy aol, you go directly to the war!




sinttulov.png



CreatureScripts


PHP:
	<event type="login" name="AolBuyer" event="script" value="aolbuyer.lua"/>



Lua:
local config =   {
                storage = 3500,
                price = 10000;
                };

function onLogin(cid)

  if getPlayerStorageValue(cid, (config.storage)) == 0 then
    return TRUE
  end
  
  if getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2173 then
    return TRUE
  end

  if getPlayerMoney(cid) < (config.price) then
    doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"WARNING: You do not have enough money to buy an amulet of loss.")
    return TRUE
  end

  doPlayerRemoveMoney(cid, (config.price))
  doPlayerAddItem(cid,2173,1)
  doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have bought an amulet of loss automatically.")
  return TRUE
end


TalkActions



PHP:
	<talkaction words="/aol" hide="yes" event="script" value="aol.lua"/>


Lua:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
		return true
	end

	if(param == 'on') then
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have turned ON the Aol Buyer.")
		doPlayerSetStorageValue(cid, 3500, 1)
		return true
	end

	if(param == 'off') then
		doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have turned OFF the Aol Buyer.")
		doPlayerSetStorageValue(cid, 3500, 0)
		return true
	end

	return true
end


Enjoy :peace:
 
Last edited:
Just a lil edit if you don't mind, everyone can learn, mine can be shortened too probably, just an example.

login:
Lua:
function onLogin(cid)
local storage, price = 3500, 10000 --config here ;p
    if getPlayerStorageValue(cid, (storage)) == 0 or getPlayerSlotItem(cid, CONST_SLOT_NECKLACE).itemid == 2173 then
        return true
    end
    if doPlayerBuyItem(cid, 2173, 1, price, 1) then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have bought an amulet of loss automatically.")
    else
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"WARNING: You do not have enough money to buy an amulet of loss.")
    end
return true
end

talkaction:
Lua:
function onSay(cid, words, param, channel)
    if(param == '') then
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")
    elseif(param == 'on') then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have turned ON the Aol Buyer.")
        doPlayerSetStorageValue(cid, 3500, 1)
    elseif(param == 'off') then
        doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR,"You have turned OFF the Aol Buyer.")
        doPlayerSetStorageValue(cid, 3500, 0)
    else
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param, use 'on' or 'off'")
    end
return true
end
 
Yeah, that's usefull too, I didn't know about the function doPlayerBuyItem, thansk mate :)
 
yeah, saves a lot of work ^_^
 
Back
Top