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

Feature Party Invitation

join:
Code:
function onSay(cid, words, param, channel)
local lid = getPlayerByName(""..param.."")
local pid = getPlayerByName(""..cid.."")
local players = getPlayersOnline()

if isInParty(cid) then
doPlayerSendCancel(cid, "You are already in party.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if not getPlayerStorageValue(cid, 9001) == 1 then
doPlayerSendCancel(cid, "You Aren't Invited To Any Party")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if(not(getPlayerByName(param))) then
doPlayerSendCancel(cid, "There is no such player nor it exists.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if param == "" then
doPlayerSendCancel(cid, "Invalid Param or Player Doesn't Exist")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if(getCreatureCondition(cid, CONDITION_INFIGHT)) then
doPlayerSendCancel(cid, "You Are InFight")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if isInParty(lid) and string.lower(getCreatureName(lid)) == string.lower(param) and getPlayerGuildId(lid) == getPlayerGuildId(cid) then
doPlayerJoinParty(cid, lid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSetStorageValue(cid, 9001)
for i, tid in ipairs(players) do
    if(getPlayerGuildId(tid) == getPlayerGuildId(cid) and cid ~= tid and isInParty(tid)) then
        doPlayerSendTextMessage(tid, 27,getCreatureName(cid).." Have Joined Your Party.")
    end
end
else
doPlayerSendCancel(cid, "Unable to join to party")
doPlayerSetStorageValue(cid, 9001)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end

Anyways thx for C++ code

So now you need to have 2 join scripts?...
 
Cuz this is guild invite,
if you use `/invite`, it will invite every online player from your guild, then `/join playername` shall join you to guild party.
 
And mine version of that script, without many bugs that you make.
invite:
Code:
function onSay(cid, words, param, channel)
local time = 30 -- in seconds
local lid = getPlayerByName(""..param.."")
local pid = getPlayerByName(""..cid.."")
local playerGuild = getPlayerGuildId(cid)
if exhaustion.check(cid, 6007) then
    doPlayerSendCancel(cid, "You Must Wait "..exhaustion.get(cid, 6007).." seconds to invite Again")
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    return true
end
if(playerGuild == 0) then
    doPlayerSendCancel(cid, "Sorry, you're not in a guild.")
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    return true
end
if(getCreatureCondition(cid, CONDITION_INFIGHT)) then
    doPlayerSendCancel(cid, "You Are InFight")
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    return true
end

exhaustion.set(cid, 6007, time)
local players = getPlayersOnline()
local members = 0
local ifAny = false
    for i, tid in ipairs(players) do
        if(getPlayerGuildId(tid) == playerGuild and cid ~= tid and not isInParty(tid)) then
        doPlayerInviteToParty(cid,tid)
        doPlayerSetStorageValue(cid, 9001, 1)
        doPlayerSendTextMessage(tid, 27, "You Have Been Invited to Guild Party.Please Say /partyjoin "..getPlayerName(cid).."")
        ifAny = true
        members = members + 1
    end
    end
    if not ifAny then
        doPlayerSendCancel(cid, "There is no guild members that you can invite.")
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
        return true
    end
    doPlayerSendTextMessage(cid, 27,members.." members has been invited")
    return true
end

join:
Code:
function onSay(cid, words, param, channel)
local lid = getPlayerByName(""..param.."")
local pid = getPlayerByName(""..cid.."")
local players = getPlayersOnline()

if isInParty(cid) then
doPlayerSendCancel(cid, "You are already in party.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if not getPlayerStorageValue(cid, 9001) == 1 then
doPlayerSendCancel(cid, "You Aren't Invited To Any Party")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if(not(getPlayerByName(param))) then
doPlayerSendCancel(cid, "There is no such player nor it exists.")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if param == "" then
doPlayerSendCancel(cid, "Invalid Param or Player Doesn't Exist")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if(getCreatureCondition(cid, CONDITION_INFIGHT)) then
doPlayerSendCancel(cid, "You Are InFight")
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
return true
end

if isInParty(lid) and string.lower(getCreatureName(lid)) == string.lower(param) and getPlayerGuildId(lid) == getPlayerGuildId(cid) then
doPlayerJoinParty(cid, lid)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
doPlayerSetStorageValue(cid, 9001)
for i, tid in ipairs(players) do
    if(getPlayerGuildId(tid) == getPlayerGuildId(cid) and cid ~= tid and isInParty(tid)) then
        doPlayerSendTextMessage(tid, 27,getCreatureName(cid).." Have Joined Your Party.")
    end
end
else
doPlayerSendCancel(cid, "Unable to join to party")
doPlayerSetStorageValue(cid, 9001)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
end
return true
end

Anyways thx for C++ code

i don't think that the lua sccript got errors but it is ok. :) thanks for doing another codes
 


:)

So, for example your script:
Lua:
if isInParty(cid) or isInParty(lid) then
--Maybe someday they finally bring back lua codes *sigh*
Sooo, you cannot invite when you are in party?

Also you can invite multiple times same person (offensive spamming).

if isInParty(lid) and string.lower(getCreatureName(lid)) == string.lower(param) then
You can join to anyone party \o/
 

Similar threads

Back
Top