SK
pedido

System de points

Por SkyDarkyes, 09 de set. de 2013 em Scripts

resolvido
14
1.5k
09 de setembro de 2013 às 20:38

Tenho esse sistema de points

function onSay(cid, words, param)
if(words == "!points") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem "..getPoints(cid).." Points.")
elseif(words == "!rankpoints") then
local max_players,str = 20,""
str = "--[ RANK POINTS ]--\n\n"
query = db.getResult("SELECT `name`, `points` FROM `players` WHERE `points` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `points` DESC, `name` ASC;")
if (query:getID() ~= -1) then k = 1 while true do
str = str .. "\n " .. k .. ". " .. query:getDataString("name") .. " - [" .. query:getDataInt("points") .. "]"
k = k + 1
if not(query:next()) or k > max_players then break end end query:free()end
if str ~= "" then doShowTextDialog(cid,6500, str) end
elseif(words == "/addpoints") then  
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "você adicionou "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Foram adicionados "..points.." Points no seu character.")  
addPoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Você agora tem "..getPoints(player).." Points.") 
end
elseif(words == "/delpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você removeu "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram removidos "..points.." Points do seu character.")  
removePoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.") 
end
elseif(words == "/setpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora o jogador "..t[1].." tem "..points.." Points no seu character.")  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "agora você tem "..points.." Points do seu character.")  
setPoints(player,points)
end
end
return TRUE
end

Gostaria de uma talkaction

exemplo

!Item

 

O ganhar recebe o X Item e X quantidade

E perde X points

Editado Setembro 9 por SkyDarkyes

aguinho600A
09 de setembro de 2013 às 20:47

 

Tenho esse sistema de points

function onSay(cid, words, param)
if(words == "!points") then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você tem "..getPoints(cid).." Points.")
elseif(words == "!rankpoints") then
local max_players,str = 20,""
str = "--[ RANK POINTS ]--\n\n"
query = db.getResult("SELECT `name`, `points` FROM `players` WHERE `points` > -1 AND `id` > 6 AND `group_id` < 2 ORDER BY `points` DESC, `name` ASC;")
if (query:getID() ~= -1) then k = 1 while true do
str = str .. "\n " .. k .. ". " .. query:getDataString("name") .. " - [" .. query:getDataInt("points") .. "]"
k = k + 1
if not(query:next()) or k > max_players then break end end query:free()end
if str ~= "" then doShowTextDialog(cid,6500, str) end
elseif(words == "/addpoints") then  
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "você adicionou "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Foram adicionados "..points.." Points no seu character.")  
addPoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_STATUS_CONSOLE_ORANGE, "Você agora tem "..getPoints(player).." Points.") 
end
elseif(words == "/delpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "você removeu "..points.." Points do jogador "..t[1])  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Foram removidos "..points.." Points do seu character.")  
removePoints(player,points)
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "Você agora tem "..getPoints(player).." Points.") 
end
elseif(words == "/setpoints") then
if getPlayerAccess(cid) == 5 then
local t = string.explode(param, ",")  
if not t[1] or not t[2] then  return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")  end  
local player = getPlayerByName(t[1])  
local points = t[2]  
local pid = getPlayerByNameWildcard(t[1])  
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then  
return TRUE,doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")  end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Agora o jogador "..t[1].." tem "..points.." Points no seu character.")  
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "agora você tem "..points.." Points do seu character.")  
setPoints(player,points)
end
end
return TRUE
end

Legal, mas e aí ? Quer ajuda no quê ?

09 de setembro de 2013 às 20:51

TNC,TÓPICO SÓ BUGA DESGRAÇA

 

@ARRUMADO

BeekiB
09 de setembro de 2013 às 22:02

TNC,TÓPICO SÓ BUGA DESGRAÇA

 

@ARRUMADO

 

Precisa xingar? essa é o ultimo aviso que lhe dou em relação ao seu comportamento aqui dentro do fórum, da próxima vez que houver algo do tipo novamente você toma ban, ok?

 

@Topic

 

Dê uma explicação melhor do que você quer.

 

Abç.

GustavoCastilhoG
09 de setembro de 2013 às 23:26

 

TNC,TÓPICO SÓ BUGA DESGRAÇA

 

@ARRUMADO

 

Precisa xingar? essa é o ultimo aviso que lhe dou em relação ao seu comportamento aqui dentro do fórum, da próxima vez que houver algo do tipo novamente você toma ban, ok?

 

@Topic

 

Dê uma explicação melhor do que você quer.

 

Abç.

 

 

As vezes da raiva mesmo, não precisa ser tão rude com ele. :( hauahua

 

@Topic

 

Você quer uma talkaction que compre itens com points vip, por meio de um comando. Correto?

10 de setembro de 2013 às 12:39

 

TNC,TÓPICO SÓ BUGA DESGRAÇA

 

@ARRUMADO

 

Precisa xingar? essa é o ultimo aviso que lhe dou em relação ao seu comportamento aqui dentro do fórum, da próxima vez que houver algo do tipo novamente você toma ban, ok?

 

@Topic

 

Dê uma explicação melhor do que você quer.

 

Abç.

 

Chinguei o tópico e não membros,pelo que eu sei não é proibido ^^

 

 

@GustavoCastilho

Sim isso mesmo

BeekiB
10 de setembro de 2013 às 12:49

qualquer comportamento destrutivo fora do Bar é proibido. happy.png

Editado Setembro 10 por Beeki

10 de setembro de 2013 às 12:54

Eu não vi nas regras do fórum,se tiver manda via PM,estamos desviando do tópico.

10 de setembro de 2013 às 14:30


function onSay(cid, words, param)

local items = {

["cystal coin"] = {item_id = 2160, item_amount = 100, points_amount = 10},

["cystal coin"] = {item_id = 2199, item_amount = 50, points_amount = 10},

["cystal coin"] = {item_id = 2170, item_amount = 80, points_amount = 10}

}

 

local items = items[param:lower()]

if(items) then

if(getPoints(cid) >= items.points_amount) then

doPlayerAddItem(cid, items.item_id, items.item_amount)

removePoints(cid, items.points_amount)

doPlayerSendTextMessage(cid, 22, "Você comprou " .. items.points_amount .. getItemNameById(items.item_id) .. ".")

else

doPlayerSendCancel(cid, "Você não tem pontos suficiente.")

end

else

doPlayerSendCancel(cid, "Este item não pode ser comprado.")

end

 

return true

end

 

 

Editado Setembro 10 por fireelement

10 de setembro de 2013 às 14:34

@Edit vlw gabi,deu certo

Editado Setembro 10 por SkyDarkyes

10 de setembro de 2013 às 14:37

atualizei o post

vinnevinneV
10 de setembro de 2013 às 14:48

hj qnd sai do serviço eu te passo um script desse tipo vc fala : !comprar dae vai aparecer um shoping do q tem pra comprar dae vc so arrumar os itens e pronto

10 de setembro de 2013 às 14:50

Vlw gaby,deu certo.

BeekiB
10 de setembro de 2013 às 14:57

Tópico movido para a seção de dúvidas e pedidos resolvidos.