Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[
- Add these modifications to database:
- item_template
- Add a column called donor_rank
- custom_enter, add this to database
- AreaId = the zone that should be locked
- Teleport_map = the map that players should get ported to if they are not allowed in (for example outside of the dungeon)
- teleport_x,y,z,o etc is the cordinat for where on the map player should be ported if not allowed in
- required_rank is the donation rank required to enter for example 1 could be +100 donor donation, and 2 could be +200 donor donation rank
- Message is the message player will recieve when they are not allowed in, for example: You do not have the required +100 donor rank.
- CREATE TABLE `custom_enter` (
- `AreaId` INT(11) NOT NULL DEFAULT '0',
- `teleport_map` INT(11) NULL DEFAULT '0',
- `teleport_x` CHAR(50) NULL DEFAULT '0',
- `teleport_y` CHAR(50) NULL DEFAULT '0',
- `teleport_z` CHAR(50) NULL DEFAULT '0',
- `teleport_o` CHAR(50) NULL DEFAULT '0',
- `required_rank` INT(11) NULL DEFAULT '0',
- `message` VARCHAR(50) NULL DEFAULT 'Not allowed',
- PRIMARY KEY (`AreaId`)
- )
- COLLATE='utf8_general_ci'
- ENGINE=InnoDB
- ;
- account_donor_rank
- This table contains the players donor rank, if they meet the requirements, they should get the rank added
- accountid is the account id of the player
- donor_rank is the rank the player should have
- CREATE TABLE `account_donor_rank` (
- `accountid` INT(11) NOT NULL,
- `donor_rank` INT(11) NOT NULL DEFAULT '0',
- PRIMARY KEY (`accountid`)
- )
- COLLATE='utf8_general_ci'
- ENGINE=InnoDB
- ;
- ]]--
- --This script is used for the Donor rank, You can set players donor rank inside donor_rank table in auth database.
- --inside custom_enter table in world database, you set the areaid which you want a "lock" on, then whe map, xyzo to where player should be ported, which msg to recieve as well as which rank is required.
- local function DonorEnterLimit(event, plr, newZone, newArea)
- local RankQuery = AuthDBQuery("SELECT donor_rank FROM account_donor_rank WHERE accountid = '"..plr:GetAccountId().."';")
- local Player_rank = RankQuery:GetUInt32(0)
- local ZoneQuery = WorldDBQuery("SELECT * FROM custom_enter WHERE AreaId = '"..newArea.."';")
- if(ZoneQuery) then
- if(Player_rank >= ZoneQuery:GetUInt32(6)) then
- plr:SendBroadcastMessage("You meet the requirement, welcome to the donor dungeon")
- else
- plr:Teleport(ZoneQuery:GetUInt32(1), ZoneQuery:GetString(2), ZoneQuery:GetString(3), ZoneQuery:GetString(4), ZoneQuery:GetString(5))
- plr:SendBroadcastMessage("[Zone Locked]: "..ZoneQuery:GetString(7))
- end
- else
- end
- end
- RegisterPlayerEvent(27, DonorEnterLimit)
- DonorItems = { }
- -- This script makes sure that the player has donor rank to equip the item.
- local function DonorEquipItemCheck(event, plr, item)
- local RankQuery = AuthDBQuery("SELECT donor_rank FROM account_donor_rank WHERE accountid = '"..plr:GetAccountId().."';")
- local Player_rank = RankQuery:GetUInt32(0)
- if not(DonorItems[item]) then
- return 0;
- end
- if(Player_rank >= DonorItems[item].donor_rank) then
- else
- plr:SendBroadcastMessage("You do not have the required donor rank of +100 donated USD to equip this item.");
- return 36;
- end
- end
- RegisterPlayerEvent(31, DonorEquipItemCheck)
- local function LoadItemsDonorRank()
- local DonorItemQuery = WorldDBQuery("SELECT entry, donor_rank FROM item_template WHERE donor_rank > 0;");
- if(DonorItemQuery)then
- repeat
- local donor_item_id = DonorItemQuery:GetUInt32(0);
- DonorItems[donor_item_id] = {
- donor_rank = DonorItemQuery:GetUInt32(1);
- };
- until not DonorItemQuery:NextRow();
- end
- end
- RegisterServerEvent(33, LoadItemsDonorRank)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement