chojrak
Banned User
- Joined
- Oct 25, 2008
- Messages
- 5,832
- Solutions
- 2
- Reaction score
- 160
Hello, i've written a Valentines Card script and I decide to post it here. You can send a card to person which you love with your custom text. You can send one card each 30 seconds.
0.3.4 Version
Mod Version
Example: !valentine Chojrak;Love ya sweety!
Thanks to Syntax for help in tests.
0.3.4 Version
Code:
function onSay(cid, words, param, channel)
local params = string.explode(param, ";")
local str = "Happy Valentine's Day!"
if (param == "" or channel ~= CHANNEL_DEFAULT or params[1] == nil) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Something bad =(")
return false
end
if (exhaustion.get(cid, 9876) ~= false) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can send one card each 30 minutes.")
return false
end
local target = getPlayerByNameWildcard(params[1])
if (not target) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot send Valentine Card to target, offline?")
return false
end
if (target == cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot send card to yourself.")
return false
end
if (params[2]) then
str = params[2]
end
local card = doCreateItemEx(6538)
doSetItemText(card, str, getCreatureName(cid))
doSetItemSpecialDescription(card, "I <3 You.")
doPlayerAddItemEx(target, card)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You sent Valentine Card to ".. params[1] ..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You receive Valentine Card from ".. getCreatureName(cid) ..".")
doSendMagicEffect(getCreaturePosition(target), CONST_ME_HEARTS)
exhaustion.set(cid, 9876, 30 * 60)
return true
end
Mod Version
Code:
<?xml version="1.0" encoding="UTF-8"?>
<mod name="Valentines Card" version="1.0" author="Chojrak" contact="[email protected]" enabled="yes">
<description>
This mod will able you to send Valentines Card.
</description>
<talkaction words="!valentine">
<![CDATA[
local params = string.explode(param, ";")
local str = "Happy Valentine's Day!"
if (param == "" or channel ~= CHANNEL_DEFAULT or params[1] == nil) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Something bad =(")
return false
end
if (exhaustion.get(cid, 9876) ~= false) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can send one card each 30 minutes.")
return false
end
local target = getPlayerByNameWildcard(params[1])
if (not target) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot send Valentine Card to target, offline?")
return false
end
if (target == cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot send card to yourself.")
return false
end
if (params[2]) then
str = params[2]
end
local card = doCreateItemEx(6538)
doSetItemText(card, str, getCreatureName(cid))
doSetItemSpecialDescription(card, "I <3 You.")
doPlayerAddItemEx(target, card)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You sent Valentine Card to ".. params[1] ..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_CONSOLE_BLUE, "You receive Valentine Card from ".. getCreatureName(cid) ..".")
doSendMagicEffect(getCreaturePosition(target), CONST_ME_HEARTS)
exhaustion.set(cid, 9876, 30 * 60)
]]>
</talkaction>
</mod>
Example: !valentine Chojrak;Love ya sweety!
Thanks to Syntax for help in tests.