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

TFS 0.X TFS 0.4 Two scripts into one

FearWar

Active Member
Joined
Sep 17, 2017
Messages
221
Reaction score
26
Location
Brasil
Hi otlanders,
I have these two scripts, one for level checking and one for guild or not and I wanted to do it all in one!

First:
Code:
function onStepIn(cid, item, position, fromPosition)

level = 80

if getPlayerLevel(cid) < level then
doTeleportThing(cid, fromPosition, true)
doSendMagicEffect(getThingPos(cid), CONST_ME_MAGIC_RED)
doPlayerSendCancel(cid,"{Castle24h} - Somente level " .. level .. " ou mais podem passar aqui.")
end
return TRUE
end
second:
Lua:
function onStepIn(cid, item, position, fromPosition)
if getPlayerGuildId(cid) > 0 then
doPlayerSendTextMessage(cid, 27, "Voce entrou, sua guild é a "..getPlayerGuildName(cid)..".")
return true
else
doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
doTeleportThing(cid, fromPosition)
return false
end
end

Help?
Post automatically merged:

the condition of the script is to have "x" level and have "guild" ...
 
Solution
Lua:
function onStepIn(cid, item, position, fromPosition)
local level = 80
        if getPlayerGuildId(cid) > 0 then
            if getPlayerLevel(cid) >= level then
                doPlayerSendTextMessage(cid, 27, "Voce entrou, sua guild é a "..getPlayerGuildName(cid)..".")
            else
                doPlayerSendTextMessage(cid, 27, "Level ".. level .."+.")
                doTeleportThing(cid, fromPosition)
            end
        else
            doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
            doTeleportThing(cid, fromPosition)
        end
    return true
end
Lua:
function onStepIn(cid, item, position, fromPosition)
local level = 80
        if getPlayerGuildId(cid) > 0 and getPlayerLevel(cid) >= level then
            doPlayerSendTextMessage(cid, 27, "Voce entrou, sua guild é a "..getPlayerGuildName(cid)..".")
        else
            doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
            doTeleportThing(cid, fromPosition)
        end
    return true
end
 
Lua:
function onStepIn(cid, item, position, fromPosition)
local level = 80
        if getPlayerGuildId(cid) > 0 and getPlayerLevel(cid) >= level then
            doPlayerSendTextMessage(cid, 27, "Voce entrou, sua guild é a "..getPlayerGuildName(cid)..".")
        else
            doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
            doTeleportThing(cid, fromPosition)
        end
    return true
end
Lua:
function onStepIn(cid, item, position, fromPosition)
local level = 80
        if getPlayerGuildId(cid) > 0 and getPlayerLevel(cid) >= level then
        else
            doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
            doTeleportThing(cid, fromPosition)
        end
    return true
end

It worked, I'm using this above, but can you improve it?
Example: if <80 send message "x", or have no guild send message "x".
Understood?
 
Lua:
function onStepIn(cid, item, position, fromPosition)
local level = 80
        if getPlayerGuildId(cid) > 0 then
            if getPlayerLevel(cid) >= level then
                doPlayerSendTextMessage(cid, 27, "Voce entrou, sua guild é a "..getPlayerGuildName(cid)..".")
            else
                doPlayerSendTextMessage(cid, 27, "Level ".. level .."+.")
                doTeleportThing(cid, fromPosition)
            end
        else
            doPlayerSendTextMessage(cid, 27, "Voce não possue guild, portanto não pode entrar no Castle24Horas.")
            doTeleportThing(cid, fromPosition)
        end
    return true
end
 
Solution
Back
Top