Ir para conteúdo

Command /addpremium


valdemorte

Posts Recomendados

addpremium.lua

function onSay(cid, words, param) 
local t = string.explode(param, ",") 
local player = getPlayerByNameWildcard(t[1]) 
local premiumdays = tonumber(t[2]) 
     if (not t[1]) then 
     doPlayerSendCancel(cid, "You must fill with a player name.") 
     elseif (premiumdays < 0) then 
        doPlayerAddPremiumDays(player, premiumdays) 
        doPlayerSendTextMessage(cid,22,"You have removed " .. t[2] .. " premium days from " .. player .. ".") 
        doPlayerSendTextMessage(player,25,"You have lost " .. t[2] .. " premium days.") 
     elseif (premiumdays >= 1 and premiumdays < 150) then 
        doPlayerAddPremiumDays(player, premiumdays) 
        doPlayerSendTextMessage(cid,22,"You have added " .. premiumdays .. " premium days from " .. getCreatureName(player) .. ".") 
        doPlayerSendTextMessage(player,25,"You received " .. premiumdays .. " premium days.")       
    end
return TRUE 
end

 

talkactions.xml

<talkaction log="yes" words="/addpremium" access="5" event="script" value="addpremium.lua"/>

Link para o comentário
Compartilhar em outros sites

Thaigo, aqui diz:

 

[color=#474747][font=monospace][size=2][color=#000000]doPlayerSendTextMessage[/color][color=#666600]([/color][color=#000000]cid[/color][color=#666600],[/color][color=#006666]22[/color][color=#666600],[/color][color=#008800]"You have removed "[/color][color=#000000] [/color][color=#666600]..[/color][color=#000000] t[/color][color=#666600][[/color][color=#006666]2[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]..[/color][color=#000000] [/color][color=#008800]" premium days from "[/color][color=#000000] [/color][color=#666600]..[/color][color=#000000] player [/color][color=#666600]..[/color][color=#000000] [/color][color=#008800]"."[/color][color=#666600])[/color][color=#000000] [/color][/size][/font][/color]

 

Qual o comando que falo pra remover os dias?

 

tipo tentei adicionar na tag de talkactions.xml assim:

 

	<talkaction log="yes" words="/addpremium;/removepremium" access="5" event="script" value="addpremium.lua"/>

 

Mais ae quando falei: /removepremium Vodkart, 1 fez foi adicionar mais um dia!

 

Vlw

Link para o comentário
Compartilhar em outros sites

obvio né cara,ele pediu um para add premium e não retirar,nunca que iria deletar premium usando aquele script.

 

 

talkactions/script

 

premium_system.lua

function onSay(cid, words, param)
if(words == "/addpremium") then
local t = string.explode(param, ",") 
local player = getPlayerByNameWildcard(t[1]) 
local premiumdays = tonumber(t[2]) 
     if (not t[1]) then 
     doPlayerSendCancel(cid, "You must fill with a player name.") 
     elseif (premiumdays < 0) then 
        doPlayerAddPremiumDays(player, premiumdays) 
        doPlayerSendTextMessage(cid,22,"You have removed " .. t[2] .. " premium days from " .. player .. ".") 
        doPlayerSendTextMessage(player,25,"You have lost " .. t[2] .. " premium days.") 
     elseif (premiumdays >= 1 and premiumdays < 150) then 
        doPlayerAddPremiumDays(player, premiumdays) 
        doPlayerSendTextMessage(cid,22,"You have added " .. premiumdays .. " premium days from " .. getCreatureName(player) .. ".") 
        doPlayerSendTextMessage(player,25,"You received " .. premiumdays .. " premium days.")       
    end
elseif(words == "/delpremium") then
local t = string.explode(param, ",")
if not t[2] then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end
local player = getPlayerByName(t[1])
local quanty = t[2]
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and  getPlayerAccess(pid) > getPlayerAccess(cid))) then 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") 
return TRUE 
end 
doPlayerAddPremiumDays(player, -quanty)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Você Removeu "..quanty.." dias de premium do jogador " .. t[1] .. ".")
elseif(words == "/checkpremium") then
if not param then 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") 
end 
local player = getPlayerByName(param) 
local pid = getPlayerByNameWildcard(param) 
if(not pid or (isPlayerGhost(pid) and  getPlayerAccess(pid) > getPlayerAccess(cid))) then 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.") 
return TRUE 
end 
local quantity = math.floor(getPlayerPremiumDays(player)) 
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "O jogador tem ".. (quantity < 0 and 0 or quantity) .." dias de premium no character.")  
end
return TRUE 
end 

 

talkactions.xml

	<talkaction log="yes" access="5" words="/addpremium;/delpremium;/checkpremium" event="script" value="premium_system.lua"/>

Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...