darphas
New Member
- Joined
- May 24, 2008
- Messages
- 17
- Reaction score
- 0
okay i want to fix this script because don't wotk in my server if someone can help i will be glad =)![Smile :) :)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
yes i have the tables in the Database also in the account have premium_points and i think that i'm doing something wrong..
i'been add to data/lib/050-function.lua
The function to get points:
The function to add points:
and the function to remove points:
okay i don't know why didn't work the script and the remove money works perfect!
the script to buy items is:
well i test it in the game and the part of: doRemovePoints give me an error in the removepoints function and the other one doPlayerRemoveMoney works perfect.. that is driving me crazy i don't know what i'm doind wrong.
yes i have the tables in the Database also in the account have premium_points and i think that i'm doing something wrong..
i'been add to data/lib/050-function.lua
The function to get points:
Code:
function getAccountPoints(cid)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
local Points= Info:getDataInt("premium_points")
Info:free()
return Points
end
return LUA_ERROR
end
The function to add points:
Code:
function doAddPoints(cid, points)
db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. points .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end
and the function to remove points:
Code:
function doRemovePoints(cid, points)
local Info = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
if Info:getID() ~= LUA_ERROR then
db.executeQuery("UPDATE accounts SET premium_points = - " .. points .. " WHERE id=" .. getPlayerAccountId(cid) .. ";")
Info:free()
return 1
end
end
okay i don't know why didn't work the script and the remove money works perfect!
the script to buy items is:
Code:
function onSay(cid, words, param)
if param == 'aol' then
if [COLOR="#FF0000"]doRemovePoints[/COLOR](cid, 5) then
doSendAnimatedText(getPlayerPosition(cid), "aol", 250)
doPlayerAddItem(cid, 2173, 1)
else
doPlayerSendCancel(cid, 'Lo siento no tienes suficiente dinero.')
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
if param == 'backpack' then
if [COLOR="#FF0000"]doPlayerRemoveMoney[/COLOR](cid, 25) then
doSendAnimatedText(getPlayerPosition(cid), "backpack", 230)
doPlayerAddItem(cid, 1988, 1)
else
doPlayerSendCancel(cid, 'Lo siento no tienes suficiente dinero.')
doSendMagicEffect(getPlayerPosition(cid), 2)
end
end
return 0
end
well i test it in the game and the part of: doRemovePoints give me an error in the removepoints function and the other one doPlayerRemoveMoney works perfect.. that is driving me crazy i don't know what i'm doind wrong.