Lucian
Active Member
Hello,
At first, I want to thank @Limos my teacher for teaching and explaining me what iam asking for.
Secondly, This GUY @imback1 made a headache to me about asking for vip system with ( check command )
so i gonna release the basic one i have,
Special Edit : @Lucian
Here we are, at first go to talkactions/scripts creat a LUA file rename it "vipsystem" and paste it
In data/talkactions/talkactions.xml
add this line
Now, Player in VIP area and his days finished he must be send out
Credits :- Vodkart
In craturescripts/scripts Create a LUA file rename it to "endvip.lua"
and paste it :-
In craturescripts/creatrescripts.xml
add this line
------------------------------------------------------------------------------------------------------------
Hope it be useful for you.
if any errors, note it please.
At first, I want to thank @Limos my teacher for teaching and explaining me what iam asking for.
Secondly, This GUY @imback1 made a headache to me about asking for vip system with ( check command )
so i gonna release the basic one i have,
Special Edit : @Lucian
Code:
Commands :-
!buyvip
!vipdays
/checkvip PLAYERNAME
/addvip PLAYERNAME, XXX(days)
/delvip PLAYERNAME, XXX(days)
Here we are, at first go to talkactions/scripts creat a LUA file rename it "vipsystem" and paste it
Code:
function onSay(cid, words, param)
if(words == "!buyvip") then
local price = XXXXXX
if doPlayerRemoveMoney(cid, price) == TRUE then
local days = 30
local daysvalue = days * 24 * 60 * 60
local storageplayer = getPlayerStorageValue(cid, 13540)
local timenow = os.time()
if getPlayerStorageValue(cid, 13540) - os.time() <= 0 then
time = timenow + daysvalue
else
time = storageplayer + daysvalue
end
if string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You had got ".. days .." days of VIP on your character.")
setPlayerStorageValue(cid, 13540, time)
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. quantity .." remaining days of VIP.")
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You had ".. days .." days of VIP on your character.")
setPlayerStorageValue(cid, 13540, time)
local name = getCreatureName(cid)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
else
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need "..price.." gp's to got VIP.")
end
elseif(words == "!vipdays") then
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(cid, 13540) - timenow)/(24 * 60 * 60))
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have ".. (quantity < 0 and 0 or quantity) .." days of VIP on your character.")
elseif(words == "/checkvip") then
if getPlayerAccess(cid) == 5 then
if not param then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
end
local player = getPlayerByName(param)
if not isPlayer(player) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player "..player.." not found.")
end
local timenow = os.time()
local quantity = math.floor((getPlayerStorageValue(player, 13540) - timenow)/(24 * 60 * 60))
doPlayerPopupFYI(cid, "The player has ".. (quantity < 0 and 0 or quantity) .." VIP days in character.")
return TRUE
end
elseif(words == "/addvip") then
if getPlayerAccess(cid) == 5 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 name = getCreatureName(player)
local days = t[2]
local pid = getPlayerByNameWildcard(t[1])
if(not pid or (isPlayerGhost(pid) and getPlayerGhostAccess(pid) > getPlayerGhostAccess(cid))) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player with this name doesn\'t exist or is offline.")
return TRUE
end
local daysvalue = days*3600*24
local storageplayer = getPlayerStorageValue(player, 13540)
local timenow = os.time()
local time = storageplayer <= 0 and (timenow + daysvalue) or (storageplayer + daysvalue)
if string.find(tostring(getCreatureName(pid)),"[[Vip]]") then
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "You had got "..days.." days of VIP on your character.")
setPlayerStorageValue(player, 13540, time)
local quantity = math.floor((getPlayerStorageValue(player,13540) - timenow)/(3600*24))
doPlayerSendTextMessage(player, MESSAGE_INFO_DESCR, "You have "..quantity.." remaining days of VIP.")
else
setPlayerStorageValue(player, 13540, time)
db.executeQuery("UPDATE `players` SET `name` = '[Vip] "..name.."' WHERE `id` = "..getPlayerGUID(player)..";")
doRemoveCreature(player)
end
end
elseif(words == "/delvip") then
if getPlayerAccess(cid) == 5 then
local dec = MESSAGE_INFO_DESCR
if(param == "") then return TRUE,doPlayerSendTextMessage(cid,18,"Command param required.")end
local C,t = {},string.explode(param, ",")
C.pos = getPlayerPosition(cid)
C.uid = getCreatureByName(t[1])
C.time = ((tonumber(t[2]) == nil) and 1 or tonumber(t[2]))*3600*24 --VIP time per day.
C.days = (tonumber(t[2]) == nil) and 1 or tonumber(t[2]) --Days of VIP.
if(getPlayerStorageValue(C.uid,13540) < C.time)then
doPlayerSendTextMessage(cid,dec,'The player '..t[1]..' doesn\'t have '..C.days..' VIP days.')
else
doPlayerSendTextMessage(cid,dec,'you have removed '..C.days..' days of vip from this player '..t[1]..'.')
setPlayerStorageValue(C.uid,13540,getPlayerStorageValue(C.uid,13540)-C.time)
end
doSendMagicEffect(C.pos, math.random(28,30))
end
end
return TRUE
end
In data/talkactions/talkactions.xml
add this line
Code:
<talkaction words="!vipdays;!buyvip;/checkvip;/addvip;/delvip" script="vipsystem.lua"/>
Now, Player in VIP area and his days finished he must be send out
Credits :- Vodkart
In craturescripts/scripts Create a LUA file rename it to "endvip.lua"
and paste it :-
Code:
function onLogin(cid)
if getPlayerStorageValue(cid, XXXX) - os.time() > 0 then
setPlayerStorageValue(cid, 9898, 1)
end
local pos = {x = XXX, y = XXX, z = XXX} -- Temple Position.
function Vodka(cid)
if isPlayer(cid) then
db.executeQuery("UPDATE `players` SET `name` = '"..string.sub(getCreatureName(cid), 7).."' WHERE `id` = "..getPlayerGUID(cid)..";")
doRemoveCreature(cid)
end
end
if getPlayerStorageValue(cid, 9898) == 1 and getPlayerStorageValue(cid, XXXXX) - os.time() < 1 or getPlayerStorageValue(cid, 13540) - os.time() == 0 then
doTeleportThing(cid, pos)
doPlayerPopupFYI(cid, "Your VIP days just ended.")
setPlayerStorageValue(cid, 9898, -1)
if string.find(tostring(getCreatureName(cid)),"[[Vip]]") then
addEvent(Vodka, 3*1000, cid)
end
end
return TRUE
end
In craturescripts/creatrescripts.xml
add this line
Code:
<event type="login" name="CheckVip" script="endvip.lua"/>
------------------------------------------------------------------------------------------------------------
Hope it be useful for you.
if any errors, note it please.
Last edited: