Kayan
Active Member
I need 1 talk actions to add premium days ;D
/addpremium"nick,days
/addpremium"nick,days
local idgroup = 3 --Min Group Access
function onSay(cid, words, param)
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
player = getCreatureName(target)
days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0")
end
end
return TRUE
end
Warning: [Event::loadScript] Can not load script. data/talkactions/scripts/premi
um.lua
data/talkactions/scripts/premium.lua:29: 'end' expected (to close 'if' at line 2
) near '<eof>'
Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/premium.lua:onSay
data/talkactions/scripts/premium.lua:2: attempt to compare number with nil
try thisfunction onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
player = getCreatureName(target)
days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0")
end
return TRUE
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
player = getCreatureName(target)
days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0")
end
end
end
end
return TRUE
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
player = getCreatureName(target)
days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added '..days..' of premium to '..player..'.")
doPlayerSendTextMessage(player, MESSAGE_STATUS_DEFAULT, "You have been given '..days..' of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0")
end
end
end
end
return TRUE
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." of premium to "..player..".")
doPlayerSendTextMessage(player, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0")
end
end
end
end
return TRUE
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online.")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type an amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." days of premium to "..player..".")
doPlayerSendTextMessage(player, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." days of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0.")
end
end
end
end
return TRUE
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online.")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type an amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." days of premium to "..target..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." days of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0.")
end
end
end
end
return TRUE
end
11:05 ADM Storm [2]: /premium"ADM Storm,10
11:06 You have added 10 days of premium to 268438868.
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online.")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type an amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/addpremium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." days of premium to "..player..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." days of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0.")
end
end
end
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online.")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type an amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/premium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." days of premium to "..player..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." days of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0.")
end
end
end
end
end
<talkaction words="/premium" script="premium.lua"/>
/premium"nick,days
function onSay(cid, words, param)
local idgroup = 3 --Min Group Access
if getPlayerGroupId(cid) < idgroup then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You can not use this command.")
elseif param ~= "" then
if string.find(param, ',') ~= nil then
local sep1 = string.find(param, ',')
local param1 = string.sub(param, 1, sep1-1)
local param2 = string.sub(param,sep1+1,string.len(param))
local target = getPlayerByName(param1)
if target == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "A player with that name is not online.")
elseif param1 == "" then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type a player.")
elseif (param2 == "") then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You must type an amount of days.")
elseif isNumber(param2) == FALSE then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be a number.")
elseif words == "/premium" then
local player = getCreatureName(target)
local days = param2
if days ~= 0 or days == 1 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." day of premium to "..player..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." day of premium account.")
elseif days ~= 0 or days > 1 then
doPlayerAddPremiumDays(target, days)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "You have added "..days.." days of premium to "..player..".")
doPlayerSendTextMessage(target, MESSAGE_STATUS_DEFAULT, "You have been given "..days.." days of premium account.")
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Days have to be higher than 0.")
end
end
end
end
end
end