LucasFerraz
Systems Analyst
I downloaded this script. It add points. The problem is:
It is not adding, it is replacing points
EDIT2:
Working 100% now.
It is not adding, it is replacing points
LUA:
function onSay(cid, words, param)
local Data = string.explode(param, ",")
if Data then
local Target = db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(Data[1]) .. ";")
if Data then
if (Target:getID() ~= -1) then
if Data[2] then
if (words:sub(2, 2) == "a") then
if isNumber(Data[2]) == TRUE then
db.executeQuery("UPDATE `accounts` SET `premium_points` = ".. Data[2] .." WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) .." LIMIT 1;")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Added ".. Data[2] .." points to player ".. Data[1] ..".")
else
doPlayerSendCancel(cid, "Insert only numbers.")
end
else
doPlayerSendCancel(cid, "To check the points do not need to enter amount of points.")
end
else
if (words:sub(2, 2) == "c") then
if premiumPointsByName(Data[1]) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The player ".. Data[1] .." do not have points.")
elseif premiumPointsByName(Data[1]) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." points.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." points.")
end
else
doPlayerSendCancel(cid, "Enter the amount of points.")
end
end
else
doPlayerSendCancel(cid, "This player ".. Data[1] .." do not exist.")
end
end
else
doPlayerSendCancel(cid, "Insert a name.")
end
return TRUE
end
EDIT2:
Working 100% now.
LUA:
function onSay(cid, words, param)
local Data = string.explode(param, ",")
if Data then
local Target = db.getResult("SELECT `name` FROM `players` WHERE `name` = " .. db.escapeString(Data[1]) .. ";")
if (Target:getID() ~= -1) then
if Data[2] then
if (words:sub(2, 2) == "a") then
if isNumber(Data[2]) == TRUE then
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + ".. Data[2] .." WHERE `accounts`.`id` = ".. getAccountIdByName(Data[1]) .." LIMIT 1;")
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Was added ".. Data[2] .." points to ".. Data[1] ..".")
else
doPlayerSendCancel(cid, "Enter only numbers.")
end
else
doPlayerSendCancel(cid, "To check the amount of points not need to enter numbers.")
end
else
if (words:sub(2, 2) == "c") then
if premiumPointsByName(Data[1]) == 0 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." has no points.")
elseif premiumPointsByName(Data[1]) == 1 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." point.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This player ".. Data[1] .." have ".. vipDaysByName(Data[1]) .." points.")
end
else
doPlayerSendCancel(cid, "Enter the amount of points.")
end
end
else
doPlayerSendCancel(cid, "This player ".. Data[1] .." does not exist.")
end
else
doPlayerSendCancel(cid, "Enter a name.")
end
return TRUE
end
Last edited: