Hello all!
Im posting this script ive made for my Ots. In my Ots are some ways to get premium points, one of them is deposit or electronic transfer to my bank acount.
When someone deposit or transfer to my bank account i simply log in on my GOD and execute this command to add their points easily.
Let see it:
Go to ots/data/talkactions/talkactions.xml and paste this:
Then go inside scripts folder, create a new file, name it premiumpoints.lua and inside paste this:
And thats all!
Here is how to use.
Ex:
/addpoints Souleater, 1000
You and target get message on ur console.
You:
03:53 You added 1000 premium points to Souleater's account.
Him:
04:02 You got 1000 premium points from Shispa.
If ur target has less ammount of points that u wanted to remove, it will remove all points.
Ex: 04:03 You removed all Souleater's account premium points.
Thats all ;D
Im posting this script ive made for my Ots. In my Ots are some ways to get premium points, one of them is deposit or electronic transfer to my bank acount.
When someone deposit or transfer to my bank account i simply log in on my GOD and execute this command to add their points easily.
Let see it:
Go to ots/data/talkactions/talkactions.xml and paste this:
Code:
<talkaction words="/addpoints;/removepoints" access="3" script="premiumpoints.lua"/>
Then go inside scripts folder, create a new file, name it premiumpoints.lua and inside paste this:
Code:
function onSay(cid, words, param)
local t = string.explode(param, ",")
if param == '' then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Missing params.")
return true
end
local player,balance,pid = getPlayerByName(t[1]),t[2],getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "That players doesnt exist or is offline.")
return TRUE
end
if t[2] == null then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Missing ammount of points.")
return TRUE
end
local accountName = getPlayerAccount(player)
local accountPoints = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `name` = '" .. accountName .. "' LIMIT 1;")
local points = tonumber(accountPoints:getDataInt("premium_points"))
local name = getPlayerName(cid)
if(words == "/addpoints")then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You added "..balance.." premium points to "..t[1].."\'s account.")
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "You got "..balance.." premium points from "..name..".")
points = (points+balance)
db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. points .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
elseif (words == "/removepoints") then
points = (points-balance)
if points < 0 then
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, ""..name.." removed all your premium points.")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You removed all "..t[1].."\'s account premium points.")
db.executeQuery("UPDATE `accounts` SET `premium_points` = '0' WHERE `name`='" .. accountName .. "' LIMIT 1;")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "You removed "..balance.." premium points to "..t[1].."\s account.")
db.executeQuery("UPDATE `accounts` SET `premium_points` = " .. points .. " WHERE `name`='" .. accountName .. "' LIMIT 1;")
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, ""..name.." removed "..balance.." premium points from your account.")
end
end
return true
end
And thats all!
Here is how to use.
Ex:
/addpoints Souleater, 1000
You and target get message on ur console.
You:
03:53 You added 1000 premium points to Souleater's account.
Him:
04:02 You got 1000 premium points from Shispa.
If ur target has less ammount of points that u wanted to remove, it will remove all points.
Ex: 04:03 You removed all Souleater's account premium points.
Thats all ;D