• 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!

neeed a vip door

Status
Not open for further replies.

Amiroslo

Excellent OT User
Joined
Jul 28, 2009
Messages
6,812
Solutions
6
Reaction score
822
plz i ned a vip door ill rep++
 
First of all, i have to say that you need the http://otland.net/f163/full-working-vip-system-shawak-44840/ to use the scripts ^_^.

Version:
TFS 0.3.5, tested.

Credits:
- Idea:
http://otland.net/f82/vip-system-19426/
http://otland.net/f81/updated-vip-system-44805/
- First scripts:
Empty
- New Version:
By me :).

Items:

Here the VIP medal:
nv64v5.png


And the door:
14e8cvr.png



Script:
-> data/actions/actions.xml
LUA:
	<!-- VIP -->
	<action actionid="5786" script="vipdoor.lua"/>
	<action itemid="5785" script="vip.lua"/>
-> data/actions/scripts/vipdoor.lua
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if isPlayerVip(cid) == TRUE then
		if getCreaturePosition(cid).y < toPosition.y then
			doTeleportThing(cid, {x=toPosition.x,y=toPosition.y+1,z=toPosition.z}, TRUE)
		else
			doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
		end
		doCreatureSay(cid, "Welcome VIP Player!", TALKTYPE_ORANGE_1)
		doSendMagicEffect(getCreaturePosition(cid), 10)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Sorry, but only VIP Players can pass here! Buy VIP on the WEB.")
	end
	return TRUE
end
-> data/actions/scripts/vip.lua
LUA:
local days = 30
local levelToBeVIP = 1

function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerLevel(cid) >= levelToBeVIP then
		if isPlayerVip(cid) == FALSE then
			doCreatureSay(cid, "CONGRATULATIONS! You are now a VIP for "..days.." days! You can now enter the VIP-area and use unique features!. ", TALKTYPE_ORANGE_1)
		end
		doSendAnimatedText(getPlayerPosition(cid), "Welcome!", TEXTCOLOR_RED) 
		doPlayerAddVipDays(cid, days)
		doRemoveItem(item.uid, 1)
		doSendAnimatedText(getCreaturePosition(cid), "+"..days.." days", 30)
	else
		doPlayerSendCancel(cid, "You need level "..levelToBeVIP.." to be a VIP player.")
	end	
	return TRUE
end

Instruction:
(give the door the actionid 5786)
2uj61pw.png


If you find any bugs, report them here! ^_^
If you like it, please don't forget to rep++. ;)

@Good Scritpers: Stop rewriting my scripts! :D

Regards,
Shawak

http://otland.net/search.php
 
sorry my error :p

Hello.
First of all If you're going to post it somewhere else, I dont want you to take credits because its 100% mine.

Well I'll explain the system.. Most of the vip system use a globalevent to remove 1 day vip every 24 hours but, what if the serv have 23 hours uptime and it crash? The day would not be removed, so I fixed it, now the vip day will be removed at an specific hour, if you set it to 2pm, the vip day will be removed at 2 pm so if the serv crash for like 3 mins it still will remove the vip days at 2pm..

Also it works to all the account, just like a premium account.
Tested in TheForgottenServer 0.3.6 / 0.4
This VIP system contains:
  • Own Lua functions
  • Automatic day remover.
  • VIP tile.
  • onLogin script to check vip.
  • VIP Medal.
  • Remove Vip Days Command.
  • Add Vip Days Command.

Okey well here it go.
Go to your phpmyadmin and execute:
Code:
ALTER TABLE `accounts` ADD
`vipdays` int(11) NOT NULL DEFAULT 0;

Now, go to data/lib/function.lua and add this lines in the top.
LUA:
--- Vip functions by Kekox
function getPlayerVipDays(cid)
    local Info = db.getResult("SELECT `vipdays` FROM `accounts` WHERE `id` = " .. getPlayerAccountId(cid) .. " LIMIT 1")
        if Info:getID() ~= LUA_ERROR then
        local days= Info:getDataInt("vipdays")
        Info:free()
        return days
    end
     return LUA_ERROR
end

function doAddVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` + " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

function doRemoveVipDays(cid, days)
    db.executeQuery("UPDATE `accounts` SET `vipdays` = `vipdays` - " .. days .. " WHERE `id` = " .. getPlayerAccountId(cid) .. ";")
end

Once you done it, add this line in data/creaturescript/login.lua
LUA:
registerCreatureEvent(cid, "VipCheck")

And now in data/creaturescript/scripts create a new file and name it vipcheck.lua
LUA:
--- Script by Kekox
function onLogin(cid)
         if getPlayerVipDays(cid) >= 1 then
            doPlayerSendTextMessage(cid, 19, "You have ".. getPlayerVipDays(cid) .." vip days left.")
         end
         return true
end

data/creaturescript/creaturescript.xml
Code:
	<event type="login" name="VipCheck" event="script" value="vipcheck.lua"/>

Now, go to data/globalevents/scripts/, create a new file and name it daysremover.lua
LUA:
--- Script by Kekox
function onTimer()
                 db.executeQuery("UPDATE accounts SET vipdays = vipdays - 1 WHERE vipdays > 0;")
        return true
end

data/globalevents/globanevents.xml
Code:
	<globalevent name="VipDaysRemover" time="00:01" event="script" value="daysremover.lua"/>

You can change the time when the vip day is going to be removed in (time="00:01").

If you have more than or just 1 vip day, when you login you'll get a message:
2yyuyq0.png


OTHER SCRIPTS!

VIP Tile

data/movements/scripts/viptile.lua
LUA:
--- Script by Kekox
function onStepIn(cid, item, position, fromPosition)
         if getPlayerVipDays(cid) == 0 then
             doTeleportThing(cid, fromPosition, FALSE)
         end
return true
end

data/movements/movements.xml
Code:
	<movevent type="StepIn" actionid="11223" event="script" value="viptile.lua"/>

In you map editor, just set action id 11223 to the tile you want to be vip tile.

VIP Medal

data/actions/scripts/vipmedal.lua
LUA:
-- Vip medal by Kekox
function onUse(cid, item, fromPosition, itemEx, toPosition)
         if getPlayerVipDays(cid) > 365 then
            doPlayerSendCancel(cid, "You can only have 1 year of vip account or less.")
         else
            doAddVipDays(cid, 30)
            doCreatureSay(cid, "VIP")
            doPlayerPopupFYI(cid, "We have added 30 vip days to your account!\nEnjoy it!.")
            doRemoveItem(item.uid)
         end
        return true
end

data/actions/actions.xml
Code:
	<action itemid="2112" event="script" value="vipmedal.lua"/>

Dont forget to change the item ID.
Add VIP days command

data/talkactions/scripts/adddays.lua
LUA:
--- Script by Kekox.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end

        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end

        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end

        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 365 vip days.")
                return true
        end

        sender = getPlayerByNameWildcard(cid)
       
    doAddVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, "You have added ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, sender .." just added you ".. t[1] .." vip days.")    
        return true
end
data/talkactions/scripts/talkactions.xml/
Code:
	<talkaction log="yes" words="/adddays" access="5" event="script" value="adddays.lua"/>

Remove VIP days command

data/talkactions/scripts/removedays.lua
LUA:
--- Script by Kekox fixed by Shawak.
function onSay(cid, words, param, channel)
        if(param == '') then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
                return true
        end

        local t = string.explode(param, ",")
        t[1] = tonumber(t[1])
        if(not t[1]) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires numeric param.")
                return true
        end

        local pid = cid
        if(t[2]) then
                pid = getPlayerByNameWildcard(t[2])
                if(not pid) then
                        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player " .. t[2] .. " not found.")
                        return true
                end
        end

        if(t[1] > 365) then
                doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can only add max 365 vip days.")
                return true
        end

        sender = getPlayerByNameWildcard(cid)
       
    doRemoveVipDays(pid, t[1])
    doPlayerSendTextMessage(cid, "You have removed ".. t[1] .." vip days to ".. t[2])
    doPlayerSendTextMessage(pid, sender .." just removed you ".. t[1] .." vip days.")    
        return true
end
data/talkactions/scripts/talkactions.xml/
Code:
	<talkaction log="yes" words="/removedays" access="5" event="script" value="removedays.lua"/>
VIP Door

data/actions/scripts/vipdoor.lua
LUA:
function onUse(cid, item, frompos, item2, topos)
         if getPlayerVipDays(cid) >= 1 then
            pos = getPlayerPosition(cid)
            if pos.x == topos.x then
               if pos.y < topos.y then
                  pos.y = topos.y + 1
               else
                  pos.y = topos.y - 1
               end
            elseif pos.y == topos.y then
                   if pos.x < topos.x then
                      pos.x = topos.x + 1
                   else
                      pos.x = topos.x - 1
                   end
            else
                doPlayerSendTextMessage(cid,22,"Stand in front of the door.")
            return true
            end
            doTeleportThing(cid,pos)
            doSendMagicEffect(topos,12)
         else
            doPlayerSendTextMessage(cid,22,'Only VIP Account can go there.')
         end
         return true
end

data/actions/actions.xml
Code:
	<action actionid="2112" event="script" value="vipdoor.lua"/>
Effect only for VIP players


globalevents/scripts/vipEffect.lua
LUA:
function onThink(interval, lastExecution)
         for _, name in ipairs(getOnlinePlayers()) do
         local cid = getPlayerByName(name)
               if getPlayerVipDays(cid) >= 1 then
                  doSendMagicEffect(getPlayerPosition(cid), 27)
                  doSendAnimatedText(getPlayerPosition(cid), "VIP!", TEXTCOLOR_RED)
               end
         end
         return true
end

data/globalevents/globalevents.xml
Code:
	<globalevent name="vipEffect" interval="2" script="vipEffect.lua"/>
Functions
  • getPlayerVipDays(cid) --- Use it to check how many vip days the player have.
  • doAddVipDays(cid, days) --- Use it to add vip days to someone.
  • doRemoveVipDays(cid, days) --- Use it to remove vip days to someone.

Enjoy it and dont forget to REP ++.

http://otland.net/search.php
 
Amirloso.. I must say you are TOO LAZY.. Try do something alone.. not be here 24/7 and spamm threads..
 
LOL he need help man! He maybe dont know so much about scripting so hes posting threads so he can get help<_<

See how well it goes<_<
 
Need SD rune
amiroslo
Yesterday 17:24
by amiroslo
6 39 Support

Gate Of Experience!! ( 1 2 3)
amiroslo
Yesterday 16:37
by kosan100
26 221 Support

/attr commands
amiroslo
Yesterday 12:47
by amiroslo
4 43 Support

player handle!!?
amiroslo
Yesterday 11:08
by amiroslo
5 39 Support

Poll: [NPC] {8.54} Npcs Package With Scripts!! [Hurry] ( 1 2 3)
amiroslo
Yesterday 11:06
by amiroslo
23 1,095 Monsters, NPC & Raids

Poll: [Monster] [8.54] Monster Package With Booses & Loot & Item [Get It Fast]!! ( 1 2 3)
amiroslo
Yesterday 04:34
by JuanC
26 1,231 Monsters, NPC & Raids

need help in monsters
amiroslo
2nd August 2010 21:42
by amiroslo
2 22 Support

8.54-8.57
amiroslo
2nd August 2010 12:11
by amiroslo
6 46 Support

Servers ( 1 2)
amiroslo
2nd August 2010 12:07
by amiroslo
10 58 Support

Poll: What is best,popular,easier.... ( 1 2 3)
amiroslo
25th July 2010 09:11
by devianceone
26 310 Computer Chat

Help me with this error ( 1 2)
amiroslo
15th July 2010 15:36
by devianceone
12 112 Support

Hoster!!
amiroslo
29th June 2010 14:46
by amiroslo
5 46 Support

All Commands!!! ( 1 2 3)
amiroslo
29th June 2010 11:26
by amiroslo
25 680 Requests & Support

doesnt this looks nice?
 
LoLLLLLLL
FAIL
......
just think how did i get 219 REP

Moderator im done
plz close :)

Ya.. but man you really should learn something.. and btw... You can't just wirte help me i'll repp ++.. tell us details.. errors.. or if its possible screenshoot
 
Last edited:
Status
Not open for further replies.
Back
Top