Julek12
New Member
- Joined
- Feb 19, 2008
- Messages
- 160
- Reaction score
- 0
Mam taki skrypt
I tutaj mam pytanie czy ten skrypt dało by się zapisać jakoś krócej? Bo czytałem, że im krótszy tym lepiej. Nie proszę o gotowy kod, ale o podpowiedź jak to zrobić.
I drugi problem
Jak widzicie są tu zastosowane Storage Value są one po to, żeby wiedzieć z jakiego miasta się teleportowaliśmy i, żeby jak wejdziemy w teleport powrotny to, żeby nas teleportowało do tego samego miasta. Czy ma ktoś pomysł jak to zrobić? Jeśli źle wytłumaczyłem to proszę powiedzieć to poprawię.
PHP:
function onStepIn(cid, item, position, fromPosition)
local config = {
ice = {x=134, y=199, z=5}
fire = {x=68, y=151, z=5}
energy = {x=72, y=197, z=5}
earth = {x=140, y=158, z=5}
message_type = MESSAGE_EVENT_ORANGE
}
if getPlayerLookDir(cid) == 0 then
newdir = 2
elseif getPlayerLookDir(cid) == 1 then
newdir = 3
elseif getPlayerLookDir(cid) == 2 then
newdir = 0
else
newdir = 1
end
if (item.actionid > 34000 and item.actionid < 34020) then
if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,config.ice)
doSendMagicEffect(config.ice,10)
setPlayerStorageValue(cid, item.actionid - 34000, 1)
else
doPlayerSendTextMessage(cid, config.message_type, "Only Premium Druids of level 30 or higher are able to enter this portal")
doMoveCreature(cid, newdir)
end
elseif (item.actionid > 34100 and item.actionid < 34120) then
if getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 6 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,config.earth)
doSendMagicEffect(config.earth,10)
setPlayerStorageValue(cid, item.actionid - 34100, 1)
else
doPlayerSendTextMessage(cid, config.message_type, "Only Premium Druids of level 30 or higher are able to enter this portal")
doMoveCreature(cid, newdir)
end
elseif (item.actionid > 34200 and item.actionid < 34220) then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,config.fire)
doSendMagicEffect(config.fire,10)
setPlayerStorageValue(cid, item.actionid - 34200, 1)
else
doPlayerSendTextMessage(cid, config.message_type, "Only Premium Sorcers of level 30 or higher are able to enter this portal")
doMoveCreature(cid, newdir)
end
elseif (item.actionid > 34300 and item.actionid < 34320) then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 5 and getPlayerLevel(cid) >= 30 and isPremium(cid) == TRUE then
doTeleportThing(cid,config.energy)
doSendMagicEffect(config.energy,10)
setPlayerStorageValue(cid, item.actionid - 34300, 1)
else
doPlayerSendTextMessage(cid, config.message_type, "Only Premium Sorcers of level 30 or higher are able to enter this portal")
doMoveCreature(cid, newdir)
end
end
end
I drugi problem
Jak widzicie są tu zastosowane Storage Value są one po to, żeby wiedzieć z jakiego miasta się teleportowaliśmy i, żeby jak wejdziemy w teleport powrotny to, żeby nas teleportowało do tego samego miasta. Czy ma ktoś pomysł jak to zrobić? Jeśli źle wytłumaczyłem to proszę powiedzieć to poprawię.