PDA

View Full Version : [Release] Commands for voters.



Paradox
20-12-09, 12:35 PM
This is one of my first scripts, made in LuaHypArc, so no need to go to hard on me.

The basic of this idea, is you vote, you get an item granded, and that item, allows you to buff yourself once or tele yourself to the voters zone or change your gender. The item will be automaticly removed when the command is used once. Also, I'm going to make somthing like this, for donators, so no need to mess around in the database anymore.
The script, and the item needed to use the commands, are on the bottom, just execute the SQL in your database, and you're done. Then just configure


local BUFF = {} And you're done.

The Command Script :

--[[ Voter Player Commands

--]]
------Message----
local BUFFS_MSG = "#Buff"
local GENDER_MSG = "#Gender"
local VOTER_MSG = "#Voteisland"
---Configs----
local BUFF = {} -- Add The Buffs You Want Them To Be Granted Here.

----Script----
function OnChat(event, pPlayer, message, type, language)
if (message == BUFF_MSG) then
if (pPlayer:GetItemCount(554455) => 1) then
pPlayer:RemoveItem(554455)
for k, v in pairs(BUFF) do
pPlayer:CastSpell(v)
pPlayer:SendBroadcastMessage("Thank you for voting")
end
else
pPlayer:SendBroadcastMessage("You havn't got enough voting tokens!")
end
end
if(message == GENDER_MSG) then
if (pPlayer:GetItemCount(554455) => 1) then
pPlayer:RemoveItem(554455)
if (pPlayer:GetGender() == 0
pPlayer:SendBroadcastMessage("Your gender has been changed!")
pPlayer:SetGender(1)
elseif pPlayer:GetGender() == 1
pPlayer:SendBroadcastMessage("Your gender has been changed!")
pPlayer:SetGender(0)
end
end
end


if(message == VOTER_MSG) then
if (pPlayer:GetItemCount(554455) => 1) then
pPlayer:RemoveItem(554455)
pPlayer:Teleport(mapid, x, y, z)
pPlayer SendBroadcastMessage("Welcome To The Voter Island "..pPlayer:GetName()..""
end
end


end

RegisterServerHook(16, "OnChat")


The Config For The Lookup Command Option :

---[[This script sends the commands you allow players to use, you can change the configuration of it, how you want it to. The \n makes the next avaible command start on a new line, if you dont want this, just delete those.


--]]
----Local-----
local COMMANDLIST_MSG = "#Commandlist"

---Script----
function OnChat(event, pPlayer, message, type, language)
if (message == COMMANDLIST_MSG) then
pPlayer:SendBroadcastMessage("Current commands:\n"..GENDER_MSG.." - Changes your gender.\n"..VOTER_MSG.."Teleports you to the VIP island.\n" ...BUFF_MSG..."Buffs you.\n" "Note, you need 1 voting token to preform these actions.")
end
end

RegisterServerHook(16, "OnChat")








The Token For The Voters (To Use The Commands) :

INSERT INTO `items` (`entry`, `class`, `subclass`, `field4`, `name1`, `displayid`, `quality`, `flags`, `faction`, `buyprice`, `sellprice`, `inventorytype`, `allowableclass`, `allowablerace`, `itemlevel`, `requiredlevel`, `RequiredSkill`, `RequiredSkillRank`, `RequiredSpell`, `RequiredPlayerRank1`, `RequiredPlayerRank2`, `RequiredFaction`, `RequiredFactionStanding`, `Unique`, `maxcount`, `ContainerSlots`, `itemstatscount`, `stat_type1`, `stat_value1`, `stat_type2`, `stat_value2`, `stat_type3`, `stat_value3`, `stat_type4`, `stat_value4`, `stat_type5`, `stat_value5`, `stat_type6`, `stat_value6`, `stat_type7`, `stat_value7`, `stat_type8`, `stat_value8`, `stat_type9`, `stat_value9`, `stat_type10`, `stat_value10`, `ScaledStatsDistributionId`, `ScaledStatsDistributionFlags`, `dmg_min1`, `dmg_max1`, `dmg_type1`, `dmg_min2`, `dmg_max2`, `dmg_type2`, `armor`, `holy_res`, `fire_res`, `nature_res`, `frost_res`, `shadow_res`, `arcane_res`, `delay`, `ammo_type`, `range`, `spellid_1`, `spelltrigger_1`, `spellcharges_1`, `spellcooldown_1`, `spellcategory_1`, `spellcategorycooldown_1`, `spellid_2`, `spelltrigger_2`, `spellcharges_2`, `spellcooldown_2`, `spellcategory_2`, `spellcategorycooldown_2`, `spellid_3`, `spelltrigger_3`, `spellcharges_3`, `spellcooldown_3`, `spellcategory_3`, `spellcategorycooldown_3`, `spellid_4`, `spelltrigger_4`, `spellcharges_4`, `spellcooldown_4`, `spellcategory_4`, `spellcategorycooldown_4`, `spellid_5`, `spelltrigger_5`, `spellcharges_5`, `spellcooldown_5`, `spellcategory_5`, `spellcategorycooldown_5`, `bonding`, `description`, `page_id`, `page_language`, `page_material`, `quest_id`, `lock_id`, `lock_material`, `sheathID`, `randomprop`, `randomsuffix`, `block`, `itemset`, `MaxDurability`, `ZoneNameID`, `mapid`, `bagfamily`, `TotemCategory`, `socket_color_1`, `unk201_3`, `socket_color_2`, `unk201_5`, `socket_color_3`, `unk201_7`, `socket_bonus`, `GemProperties`, `ReqDisenchantSkill`, `ArmorDamageModifier`, `existingduration`, `ItemLimitCategoryId`, `HolidayId`) VALUES ('554455', '10', '0', '-1', 'Voter's Badge', '40753', '4', '2048', '0', '0', '0', '0', '262143', '32767', '70', '70', '0', '0', '0', '0', '0', '0', '0', '2147483647', '2147483647', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0.0', '0.0', '0', '0.0', '0.0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0.0', '0', '0', '0', '-1', '0', '-1', '0', '0', '0', '-1', '0', '-1', '0', '0', '0', '-1', '0', '-1', '0', '0', '0', '-1', '0', '-1', '0', '0', '0', '-1', '0', '-1', '1', '', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0', '0', '0', '0', '0', '8192', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '0', '0');





-Credits : Me for making the actual script.
Grandelf for helping me.
I watched at Onkyl's scripts to learn, but I DIDN'T copy.



Note : if you have any idea for the donator commands - which commands you want me to put on there, just post here.