• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Solved add points on gesior

1268995

Member
Joined
Sep 9, 2010
Messages
422
Reaction score
13
Is it possible?

I want a system with this talkactions:

!addpoints --> this talkaction will take, for example, 1 crystal coin from his backpack and add 1 points on gesior.

!takepoints --> this talkaction will make player lose 1 points on shop gesior and will add 1 crystal coin on his backpack.

Is it possible?
 
For example on my server i used.

Function
Code:
 -- Prestige Points --
function getPlayerPrestigeP(cid)
  local Info = db.getResult("SELECT `Prestige Points` FROM `players` WHERE `id` = " .. getPlayerGUID(cid) .. " LIMIT 1")
  if Info:getID() ~= LUA_ERROR then
  local presp= Info:getDataInt("Prestige Points")
  Info:free()
  return presp
  end
  return LUA_ERROR
end

and the script it was used in was like this.
Code:
local pp = 1
local cancelmsg = "You need "..pp.." prestige points."
local buymsg = "Congratulations! You have received 1 day of premium for "..pp.." Prestige point."
local Message = "You need "..pp.." coins to buy this item."


function onUse(cid, item, fromPosition, itemEx, toPosition)
if getPlayerPrestigeP(cid) < pp then
doPlayerSendTextMessage(cid,19,cancelmsg)
elseif getPlayerPrestigeP (cid) >= pp then
doCreatureSay(cid, buymsg, TALKTYPE_ORANGE_1)
doRemovePrestigep(cid, pp)
doPlayerAddPremiumDays(cid, 1)
else
doPlayerSendTextMessage(cid,19,Message)
end
return true
end
 
Ok so you figured out how to alter that code i gave you..

Your solution.
Code:
function getAccountPoints(cid)
local res = db.getResult('select `premium_points` from accounts where name = \''..getPlayerAccount(cid)..'\'')
if(res:getID() == -1) then
return false
end
local ret = res:getDataInt("premium_points")
res:free()
return tonumber(ret)
end

Now that line of code you altered above is used as a function go to you lib folder and add it at the bottom of "050-function.lua" file.

Now goto your script and all you do is add this to return the premium points the player has.
Code:
getAccountPoints(cid)

Worked! well, now i want a exhausted function to avoid people to eventyaly bug the system how can i do that?
I mean, exhausted in using the talkaction
 
I gave you 98% of the whole thing you can finish the last 2% I'm sorry to be an anus about it but its the fact of life i gave you more then i was willing to give :p
 
But i can give you another example.

Potion script.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(not isPlayer(itemEx.uid)) then
     return false
   end

   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     return true
   end

   if(not doCombat(cid, combat, numberToVariant(itemEx.uid))) then
     return false
   end

   doAddCondition(cid, exhaust)
   doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
   doTransformItem(item.uid, EMPTY_POTION)
   return true
end
stuff you will need to find out where it go's
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
Code:
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     return true
   end
Code:
doAddCondition(cid, exhaust)
 
In example, exhaus time are in minutes.. i need it in seconds...



Will try yours too.
Its not that they do much of a difference personally i would use the storage id one "his" due to it not using the healing exhaust. I just gave you an idea on what to do and you already have more then 10 of the same scripts in your server :) just blinded by words is all
 
It's basic math... 1000 = 1 second. You should be able to figure out what numbers to change.

@RosOT,

Maybe it's not too easy, lol.

I mean: exhaustTime = 1, -- minutes
How to change to seconds?

EDIT:
i got this:
Code:
function onSay(cid, words, param)
local points = 1
doAccountAddPoints(cid, points)
doPlayerRemoveItem(cid, 2157, 1)
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você enviou "..points.." Soft Coins do seu personagem para o site!")
end

i dont have an "if" function.. so how can i add exhsuted if i do not have if function?
 
But i can give you another example.

Potion script.
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_HEALING)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_MAGIC_BLUE)
setCombatParam(combat, COMBAT_PARAM_TARGETCASTERORTOPMOST, true)
setCombatParam(combat, COMBAT_PARAM_AGGRESSIVE, false)
setCombatParam(combat, COMBAT_PARAM_DISPEL, CONDITION_POISON)

local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))

function onUse(cid, item, fromPosition, itemEx, toPosition)
   if(not isPlayer(itemEx.uid)) then
     return false
   end

   if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     return true
   end

   if(not doCombat(cid, combat, numberToVariant(itemEx.uid))) then
     return false
   end

   doAddCondition(cid, exhaust)
   doCreatureSay(itemEx.uid, "Aaaah...", TALKTYPE_ORANGE_1)
   doTransformItem(item.uid, EMPTY_POTION)
   return true
end
stuff you will need to find out where it go's
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
Code:
if(hasCondition(cid, CONDITION_EXHAUST_HEAL)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     return true
   end
Code:
doAddCondition(cid, exhaust)

In this code i cant configure the time i want that be exhausted.
 
looks like a ticks? ticks = time
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
Code:
getConfigInfo('timeBetweenExActions'


I am going to bed soon so this is last thing im puting in here .. last example!
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 50))

local runes = {
[2305] = {
min = 'level * 1 + maglv * 1',
max = 'level * 3 + maglv * 3'
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

if(hasCondition(cid, CONDITION_EXHAUST)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     doSendMagicEffect(toPosition, CONST_ME_POFF)
     return true
   end

if isPlayer(itemEx.uid) then
level, maglv, i = getPlayerLevel(cid), getPlayerMagLevel(cid), runes[item.itemid]
doCreatureAddHealth(itemEx.uid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
level, maglv, i = nil, nil, nil
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, 'T/HP: 1', TALKTYPE_ORANGE_1)
doAddCondition(cid, exhaust)
if math.random(100) == 1 then
end
else
doPlayerSendCancel(cid, 'You are exausted!')
end
return true
end
 
looks like a ticks? ticks = time
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, getConfigInfo('timeBetweenExActions'))
Code:
getConfigInfo('timeBetweenExActions'


I am going to bed soon so this is last thing im puting in here .. last example!
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 50))

local runes = {
[2305] = {
min = 'level * 1 + maglv * 1',
max = 'level * 3 + maglv * 3'
}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)

if(hasCondition(cid, CONDITION_EXHAUST)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     doSendMagicEffect(toPosition, CONST_ME_POFF)
     return true
   end

if isPlayer(itemEx.uid) then
level, maglv, i = getPlayerLevel(cid), getPlayerMagLevel(cid), runes[item.itemid]
doCreatureAddHealth(itemEx.uid, math.random(loadstring('return '..i.min)(), loadstring('return '..i.max)()))
level, maglv, i = nil, nil, nil
doSendMagicEffect(toPosition, CONST_ME_MAGIC_BLUE)
doCreatureSay(itemEx.uid, 'T/HP: 1', TALKTYPE_ORANGE_1)
doAddCondition(cid, exhaust)
if math.random(100) == 1 then
end
else
doPlayerSendCancel(cid, 'You are exausted!')
end
return true
end

Dont work.

Exhausted is not working because he is not using the item. (function on use).
This is a function on say, then this exhausted is not working :/
 
@1268995 if you cant figure this out you might have slight issues you need to work on go to the tutorials thread and read up on how to do certain stuff.
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onSay(cid, words, param, channel)
if(hasCondition(cid, CONDITION_EXHAUST)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     doSendMagicEffect(toPosition, CONST_ME_POFF)
     return true
   end

if doRemoveItem(cid, 2157) == TRUE then
-- add your shit here --
doAddCondition(cid, exhaust)
end
return true
end
 
@1268995 if you cant figure this out you might have slight issues you need to work on go to the tutorials thread and read up on how to do certain stuff.
Code:
local exhaust = createConditionObject(CONDITION_EXHAUST)
setConditionParam(exhaust, CONDITION_PARAM_TICKS, (getConfigInfo('timeBetweenExActions') - 100))

function onSay(cid, words, param, channel)
if(hasCondition(cid, CONDITION_EXHAUST)) then
     doPlayerSendDefaultCancel(cid, RETURNVALUE_YOUAREEXHAUSTED)
     doSendMagicEffect(toPosition, CONST_ME_POFF)
     return true
   end

if doRemoveItem(cid, 2157) == TRUE then
-- add your shit here --
doAddCondition(cid, exhaust)
end
return true
end

Worked ty!
 
Back
Top