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

[7.72] OTHire 0.0.1b - Based in OTServ Trunk (Latest)

Credits:
-Wille,For Testing, hella tests lol xD
-Guilherme Aka KreXt, Some Tests too

This is not my cast system, it is Summ's i just added it

http://speedy*****malware.localhost/8aSVs/Othire.rar

Othire source with Cast System and Experience Share

Experience Share Script:
Code:
function onSay(cid, words, param)
   if hasCondition(cid, CONDITION_INFIGHT) then
     doPlayerSendCancel(cid, "You cant share exp while infight")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
     return true
   end
   if isPartyLeader(cid) and #getPartyMembers(cid) >= 2 then
     if param == "on" then
       if not isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, true)
         for i = 1,#getPartyMembers(cid) do
           doPlayerSendCancel(cid, "Exp Shared is already off")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already on")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
     elseif param == "off" then
       if isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, false)
         for i = 1,#getPartyMembers(cid) do
           doPlayerSendCancel(cid, "Exp Shared is already ON")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already off")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
     else
       doPlayerSendCancel(cid, "Param needed")
       doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
     end
   else
     doPlayerSendCancel(cid, "You need to be party leader or in Party")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
   end
   return true
end

Cast System Script:
Code:
function onSay(cid, words, param, channel)
   local tmp = param:explode(" ")
   if not(tmp[1]) then
     return doPlayerSendCancel(cid, "Parameters needed")
   end
   
   if tmp[1] == "on" then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has started.")
     doPlayerSetCastState(cid, 1)
   elseif getPlayerCast(cid).status == false then
     return doPlayerSendCancel(cid, "Your cast has to be running for this action.")
   elseif tmp[1] == "off" then
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast has ended.")
     doPlayerSetCastState(cid, 0)
     doPlayerSave(cid)
   elseif isInArray({"pass", "password", "p"}, tmp[1]) then
     if not(tmp[2]) then
       return doPlayerSendCancel(cid, "You need to set a password")
     end
     
     if tmp[2]:len() > 10 then
       return doPlayerSendCancel(cid, "The password is too long. (Max.: 10 letters)")
     end
     
     if tmp[2] == "off" then
       doPlayerSetCastPassword(cid, "")
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password has been removed.")
     else
       doPlayerSetCastPassword(cid, tmp[2])
       doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast password was set to: " .. tmp[2])
     end
   elseif isInArray({"desc", "description", "d"}, tmp[1]) then
     local d = param:gsub(tmp[1]..(tmp[2] and " " or ""), "")
     
     if not(d) or d:len() == 0 then
       return doPlayerSendCancel(cid, "You need to specify a description.")
     end
     
     if d:len() > 50 then
       return doPlayerSendCancel(cid, "The description is too long. (Max.: 50 letters)")
     end
     
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cast description was set to: ")
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, d)
     doPlayerSetCastDescription(cid, d)
   elseif tmp[1] == "ban" then
     if not(tmp[2]) then
       return doPlayerSendCancel(cid, "Specify a spectator that you want to ban.")
     end
     
     if doPlayerAddCastBan(cid, tmp[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been banned.")
     else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be banned.")
     end
   elseif tmp[1] == "unban" then
     if not(tmp[2]) then
       return doPlayerSendCancel(cid, "Specify the person you want to unban.")
     end
     
     if doPlayerRemoveCastBan(cid, tmp[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unbanned.")
     else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unbanned.")
     end
   elseif param == "bans" then
     local t = getCastBans(cid)
     local text = "Cast Bans:\n\n"
     for k, v in pairs(t) do
       text = text .. "*" .. v.name .. "\n"
     end
     if text == "Cast Bans:\n\n" then
       text = text .. "No bans."
     end
     doShowTextDialog(cid, 5958, text)
   elseif tmp[1] == "mute" then
     if not(tmp[2]) then
       return doPlayerSendCancel(cid, "Specify a spectator that you want to mute.")
     end
     
     if doPlayerAddCastMute(cid, tmp[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been muted.")
     else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be muted.")
     end
   elseif tmp[1] == "unmute" then
     if not(tmp[2]) then
       return doPlayerSendCancel(cid, "Specify the person you want to unmute.")
     end
     
     if doPlayerRemoveCastMute(cid, tmp[2]) then
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' has been unmuted.")
     else
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Spectator '" .. tmp[2] .. "' could not be unmuted.")
     end
   elseif param == "mutes" then
     local t = getCastMutes(cid)
     local text = "Cast Mutes:\n\n"
     for k, v in pairs(t) do
       text = text .. "*" .. v.name .. "\n"
     end
     if text == "Cast Bans:\n\n" then
       text = text .. "No mutes."
     end
     doShowTextDialog(cid, 5958, text)
   elseif param == "viewers" then
     local t = getCastViewers(cid)
     local text, count = "Cast Viewers:\n#Viewers: |COUNT|\n\n", 0
     for _,v in pairs(t) do
       count = count + 1
       text = text .. "*" .. v.name .."\n"
     end
     
     if text == "Cast Viewers:\n#Viewers: |COUNT|\n\n" then text = "Cast Viewers:\n\nNo viewers." end
     text = text:gsub("|COUNT|", count)
     doShowTextDialog(cid, 5958, text)
   elseif param == "status" then
     local t, c = getCastViewers(cid), getPlayerCast(cid)
     local count = 0
     for _,v in pairs(t) do count = count + 1 end
     
     doShowTextDialog(cid, 5958, "Cast Status:\n\n*Viewers:\n  " .. count .. "\n*Description:\n  "..(c.description == "" and "Not set" or c.description).."\n*Password:\n  " .. (c.password == "" and "Not set" or "Set - '"..c.password.."'"))
   elseif param == "update" then
     if getPlayerStorageValue(cid, 656544) > os.time() then
       return doPlayerSendCancel(cid, "You used this command lately. Wait: " .. (getPlayerStorageValue(cid, 656544)-os.time()) .. " sec.")
     end
     doPlayerSave(cid)
     doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "The cast settings have been updated.")
     doPlayerSetStorageValue(cid, 656544, os.time()+60)
   end
   return true
end

Config:
Code:
enableCast = true
experienceShareRadiusX = 30
experienceShareRadiusY = 30 
experienceShareRadiusZ = 1
experienceShareActivity = 120000
party_exp_mul = 5
partyDifference = 0.75

Any experience gained by the player will be shared among the players, it is not a perfect system but this is the best i could do, i didn't test for long but it shouldn't crash / bug..
Enjoy
 
@tetra20 what sources do you changed for the shared exp system?
I have made changes on my sources and I need to know where to look.
 
Hello. Can someone explain and show me how to make a NPC buyer using the functions in modules.lua.

Here is the example of my code:
Code:
    if msgcontains(msg, "tempest rod") then
        if doPlayerRemoveItem(cid, 2183, 1) then
            doPlayerAddMoney(cid, 3000)
            npcHandler:say("Thanks mate.")
        else
            npcHandler:say(npcHandler:getMessage(8))

But i saw those functions in modules.lua and its possible to sell multiple items with the same name if im not wrong. Sample of working NPC lua script would be nice, but ill appreciate all the help. Thanks
 
Experience Share Script:
Code:
function onSay(cid, words, param)
   if hasCondition(cid, CONDITION_INFIGHT) then
     doPlayerSendCancel(cid, "You cant share exp while infight")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
     return true
   end
   if isPartyLeader(cid) and #getPartyMembers(cid) >= 2 then
     if param == "on" then
       if not isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, true)
         for i = 1,#getPartyMembers(cid) do
           doPlayerSendCancel(cid, "Exp Shared is already off")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already on")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
     elseif param == "off" then
       if isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, false)
         for i = 1,#getPartyMembers(cid) do
           doPlayerSendCancel(cid, "Exp Shared is already ON")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already off")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
     else
       doPlayerSendCancel(cid, "Param needed")
       doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
     end
   else
     doPlayerSendCancel(cid, "You need to be party leader or in Party")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
   end
   return true
end

That script is not working as intended, every time you share on/off experience you get incorrect message in the loop:
Code:
for i = 1,#getPartyMembers(cid) do
           doPlayerSendCancel(cid, "Exp Shared is already off")
         end
And only in the party leader, it doesn't inform the rest of party members if shared experience is on/off

Any help?
 
Can't edit my own posts.

Here is my attempt to fix the script, but it only sends message to party leader:
Code:
function onSay(cid, words, param)
   if hasCondition(cid, CONDITION_INFIGHT) then
     doPlayerSendCancel(cid, "You cant share exp while infight")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
     return true
   end
   if isPartyLeader(cid) and #getPartyMembers(cid) >= 2 then

    if param == "on" then
       if not isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, true)
         for i = 1,#getPartyMembers(cid) do
          doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Shared Experience has been activated")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already on")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
    elseif param == "off" then
       if isPartySharedExperienceActive(cid) then
         setPartySharedExperience(cid, false)
         for i = 1,#getPartyMembers(cid) do
           doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Shared Experience has been deactivated")
         end
       else
         doPlayerSendCancel(cid, "Exp Shared is already off")
         doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
       end
    else
       doPlayerSendCancel(cid, "Param needed")
       doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
    end
   else
     doPlayerSendCancel(cid, "You need to be party leader or in Party")
     doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
   end
   return true
end
 
Code:
function onSay(cid, words, param)
  if hasCondition(cid, CONDITION_INFIGHT) then
  doPlayerSendCancel(cid, "You cant share exp while infight")
  doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
  return true
  end
  if isPartyLeader(cid) and #getPartyMembers(cid) >= 2 then

  if param == "on" then
  if not isPartySharedExperienceActive(cid) then
  setPartySharedExperience(cid, true)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Shared Experience has been activated")
  for i = 1,#getPartyMembers(cid) do
  doPlayerSendTextMessage(getPartyMembers(cid)[i], MESSAGE_INFO_DESCR, "Shared Experience has been activated")
  end
  else
  doPlayerSendCancel(cid, "Exp Shared is already on")
  doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
  end
  elseif param == "off" then
  if isPartySharedExperienceActive(cid) then
  setPartySharedExperience(cid, false)
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Shared Experience has been deactivated")
  for i = 1,#getPartyMembers(cid) do
  doPlayerSendTextMessage(getPartyMembers(cid)[i], MESSAGE_INFO_DESCR, "Shared Experience has been deactivated")
  end
  else
  doPlayerSendCancel(cid, "Exp Shared is already off")
  doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
  end
  else
  doPlayerSendCancel(cid, "Param needed")
  doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
  end
  else
  doPlayerSendCancel(cid, "You need to be party leader or in Party")
  doSendMagicEffect(getThingPos(cid),CONST_ME_POFF)
  end
  return true
end
 
Sorry for the double post I didnt notice this thread's about OTHire and not OTClient.

@Tatuy1 just rework on your OTClient and take buttons that are not "usable" in 7.72 out. (Console and a lot of other modules). If you're lazy just edit CIP's client.
 
Back
Top