Witam prezentuje wam m?j pierwszy skrypt, kt?rym jest komenda !soft
W talkactions/scripts tworzymy soft.lua
Do talkactions.xml dodajemy linijke
W talkactions/scripts tworzymy soft.lua
PHP:
function onSay(cid, words, param)
local config = {
stare = 6530, -- id zepsutych
nowe = 2640,
cost = 10000,
good_effect = 29,
fail_effect = 2,
no_money = "Nie masz pieniedzy",
no_soft = "Nie masz soft\'ow",
good = "Naladowales softy !"
}
function onSay(cid, words, param)
if(getPlayerMoney(cid) >= config.cost) then
if(getPlayerItemCount(cid, config.stare) > 0) then
doSendMagicEffect(getCreaturePosition(cid), config.good_effect)
doPlayerSendTextMessage(cid, 22, config.good)
doPlayerRemoveItem(cid, config.stare, 1)
doPlayerAddItem(cid, config.nowe, 1)
else
doPlayerSendTextMessage(cid, 22, config.no_soft)
doSendMagicEffect(getCreaturePosition(cid), config.fail_effect)
end
else
doPlayerSendTextMessage(cid,22, config.no_money)
doSendMagicEffect(getCreaturePosition(cid), config.fail_effect)
end
return 1
end
PHP:
<talkaction words="!soft" event="script" value="soft.lua"/>