Advertisement
Guest User

Untitled

a guest
Jul 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.80 KB | None | 0 0
  1. --[[
  2. Add these modifications to database:
  3. item_template
  4.     Add a column called donor_rank
  5.  
  6. custom_enter, add this to database
  7. AreaId = the zone that should be locked
  8. Teleport_map = the map that players should get ported to if they are not allowed in (for example outside of the dungeon)
  9. teleport_x,y,z,o etc is the cordinat for where on the map player should be ported if not allowed in
  10. 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
  11. Message is the message player will recieve when they are not allowed in, for example: You do not have the required +100 donor rank.
  12. CREATE TABLE `custom_enter` (
  13.     `AreaId` INT(11) NOT NULL DEFAULT '0',
  14.     `teleport_map` INT(11) NULL DEFAULT '0',
  15.     `teleport_x` CHAR(50) NULL DEFAULT '0',
  16.     `teleport_y` CHAR(50) NULL DEFAULT '0',
  17.     `teleport_z` CHAR(50) NULL DEFAULT '0',
  18.     `teleport_o` CHAR(50) NULL DEFAULT '0',
  19.     `required_rank` INT(11) NULL DEFAULT '0',
  20.     `message` VARCHAR(50) NULL DEFAULT 'Not allowed',
  21.     PRIMARY KEY (`AreaId`)
  22. )
  23. COLLATE='utf8_general_ci'
  24. ENGINE=InnoDB
  25. ;
  26.  
  27. account_donor_rank
  28. This table contains the players donor rank, if they meet the requirements, they should get the rank added
  29. accountid is the account id of the player
  30. donor_rank is the rank the player should have
  31. CREATE TABLE `account_donor_rank` (
  32.     `accountid` INT(11) NOT NULL,
  33.     `donor_rank` INT(11) NOT NULL DEFAULT '0',
  34.     PRIMARY KEY (`accountid`)
  35. )
  36. COLLATE='utf8_general_ci'
  37. ENGINE=InnoDB
  38. ;
  39.  
  40.  
  41. ]]--
  42.  
  43.  
  44.  
  45. --This script is used for the Donor rank, You can set players donor rank inside donor_rank table in auth database.
  46. --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.
  47.  
  48. local function DonorEnterLimit(event, plr, newZone, newArea)
  49.     local RankQuery = AuthDBQuery("SELECT donor_rank FROM account_donor_rank WHERE accountid = '"..plr:GetAccountId().."';")
  50.     local Player_rank = RankQuery:GetUInt32(0)
  51.    
  52.     local ZoneQuery = WorldDBQuery("SELECT * FROM custom_enter WHERE AreaId = '"..newArea.."';")
  53.     if(ZoneQuery) then
  54.         if(Player_rank >= ZoneQuery:GetUInt32(6)) then
  55.             plr:SendBroadcastMessage("You meet the requirement, welcome to the donor dungeon")
  56.         else
  57.             plr:Teleport(ZoneQuery:GetUInt32(1), ZoneQuery:GetString(2), ZoneQuery:GetString(3), ZoneQuery:GetString(4), ZoneQuery:GetString(5))
  58.             plr:SendBroadcastMessage("[Zone Locked]: "..ZoneQuery:GetString(7))
  59.         end
  60.     else
  61.    
  62.     end
  63. end
  64.  
  65. RegisterPlayerEvent(27, DonorEnterLimit)
  66. DonorItems = { }
  67. -- This script makes sure that the player has donor rank to equip the item.
  68. local function DonorEquipItemCheck(event, plr, item)
  69.     local RankQuery = AuthDBQuery("SELECT donor_rank FROM account_donor_rank WHERE accountid = '"..plr:GetAccountId().."';")
  70.     local Player_rank = RankQuery:GetUInt32(0)
  71.     if not(DonorItems[item]) then
  72.         return 0;
  73.     end
  74.     if(Player_rank >= DonorItems[item].donor_rank) then
  75.  
  76.     else
  77.         plr:SendBroadcastMessage("You do not have the required donor rank of +100 donated USD to equip this item.");
  78.         return 36;
  79.     end
  80.  
  81. end
  82. RegisterPlayerEvent(31, DonorEquipItemCheck)
  83.  
  84.  
  85. local function LoadItemsDonorRank()
  86.     local DonorItemQuery = WorldDBQuery("SELECT entry, donor_rank FROM item_template WHERE donor_rank > 0;");
  87.      if(DonorItemQuery)then
  88.         repeat
  89.             local donor_item_id = DonorItemQuery:GetUInt32(0);
  90.             DonorItems[donor_item_id] = {
  91.                 donor_rank = DonorItemQuery:GetUInt32(1);
  92.             };
  93.         until not DonorItemQuery:NextRow();
  94.     end
  95. end
  96. RegisterServerEvent(33, LoadItemsDonorRank)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement