zerghel
Tsuni
- Joined
- Jul 1, 2008
- Messages
- 299
- Reaction score
- 9
i need to convert this talkaction so the player can buy items in znote acc shop only using ingame money, but im just a newbie in scripting
Code:
dofile('./config.lua')
function addPoints(playerName, amount)
local accNum = getAccountNumberByPlayerName(playerName)
if accNum == 0 or amount == 0 then
return
end
local env = assert(luasql.mysql())
local con = assert(env:connect(mysqlDatabase, mysqlUser, mysqlPass, mysqlHost, mysqlPort))
assert(con:execute('UPDATE `znote_accounts` SET `points` = `points` + ' .. amount .. ' WHERE `account_id` = ' .. accNum .. ' LIMIT 1;'))
con:close()
env:close()
end
function onSay(cid, words, param)
if doPlayerRemoveMoney(cid, 100000) then
addPoints(getCreatureName(cid), 10)
doCreatureSay(cid, 'You have received 10 premium points!', TALKTYPE_ORANGE_1)
else
doPlayerSendCancel(cid, "You don't have enough money, 10 premium point costs 10 crystal coins.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
end
Last edited: