Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSay(cid, words, param, channel)
- local t = string.explode(param, ",")
- if(param == '') then
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "Exemplo de como usar o comando:\nTransferir 50 points para o player 'Amigo'\n!transferpoints, Amigo, 50")
- return true
- end
- local playerReceb = getPlayerByNameWildcard(tostring(t[1]))
- if(not isPlayer(playerReceb)) then
- doPlayerSendCancel(cid, "Esse jogador nao existe ou nao esta online.")
- return true
- end
- if not t[2] or not isNumber(t[2]) then
- doPlayerSendCancel(cid, "Exemplo de como usar o comando: !transferpoints, Amigo, 50")
- return true
- end
- local points = tonumber(t[2])
- local getMyAcc = getPlayerAccountId(cid)
- local ownGet = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = '".. getMyAcc.."';")
- local ownPoints = tonumber(ownGet:getDataString('premium_points'))
- local getTargetAcc = getPlayerAccountId(playerReceb)
- local targGet = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = '".. getTargetAcc.."';")
- local targPoints = tonumber(targGet:getDataString('premium_points'))
- if ownPoints <= points then
- doPlayerSendCancel(cid, "Voce não tem points suficientes")
- return true
- end
- db.executeQuery("UPDATE `accounts` SET `premium_points` = ".. (ownPoints-points) .." WHERE `id` = " .. getMyAcc .. ";")
- db.executeQuery("UPDATE `accounts` SET `premium_points` = ".. (targPoints+points) .." WHERE `id` = " .. getTargetAcc .. ";")
- doPlayerSendTextMessage(playerReceb, MESSAGE_STATUS_CONSOLE_BLUE, "".. getPlayerName(cid) .." te deu ".. points .." Premium Points que podem ser utilizados para comprar itens em nosso site!")
- doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "".. t[1] .." recebeu seus ".. points .." Premium Points com sucesso!")
- return true
- end
Add Comment
Please, Sign In to add comment