-Skrypt logowanie

Status
Zamknięty.

orzelbot

Advanced User
Zarejestrowany
Dołączył
Listopad 11, 2008
Posty
189
Liczba reakcji
5
siema,
potrzebuje skrypta, ktory:
jak ktos pierwszy raz loguje na serwer to
daje go na losowe pozycje wpisane w skrypcie,
np 333, 444, 5; 666, 777, 8; 999, 111, 2 (xxx, yyy, z)
ale jak juz zobi reloga, czyli bedzie to jego drugie zalogowanie
to da go tam gdzie sie ostatnio wylogowal (normalnie).

za pomoc rep++
pozdrawiam
 
Odp: logowanie

do creaturescripts\login.lua po linijkach z registerCreatureEvent dodaj
local playerPosition = getPlayerPosition(cid)
local choose = pos
pos = {x=aaa, y=bbb, z=7}
pos1 = {x=aaa, y=bbb, z=7}
pos2 = {x=aaa, y=bbb, z=7}
pos3 = {x=aaa, y=bbb, z=7}
pos4 = {x=aaa, y=bbb, z=7}
pos5 = {x=aaa, y=bbb, z=7}


if getPlayerStorageValue(cid, xxxx) == -1 then
setPlayerStorageValue(cid, xxxx, 1)
local randomChance = math.random(1, 6)
if(randomChance == 1) then
choose = pos
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
elseif(randomChance == 2) then
choose = pos1
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
elseif(randomChance == 3) then
choose = pos2
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
elseif(randomChance == 4) then
choose = pos3
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
elseif(randomChance == 5) then
choose = pos4
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
elseif(randomChance == 6) then
choose = pos5
getThingfromPos(playerPosition)
doTeleportThing(cid,choose)
end
return TRUE
else
end

Nie wiem, czy b?dzie dzia?a?. W ka?dym razie to b?dzie co? podobnego.
 
Odp: logowanie

Dodaj to gdzie? przed lub po registerCreatureEvent w login.lua
PHP:
local storage = 81732
local positions = {
	{x = , y = , z = }, -- pozycja 1
	{x = , y = , z = }, -- pozycja 2
	{x = , y = , z = } -- pozycja 3
}

if(getPlayerStorageValue(cid, storage) < 1) then
	local position = positions[math.random(1, #positions)]
	doTeleportThing(cid, position)
	doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	setPlayerStorageValue(cid, storage, 1)
end
 
Odp: logowanie

zrobilem tak:
PHP:
local config = {
	loginMessage = getConfigValue('loginMessage'),
	useFragHandler = getBooleanFromString(getConfigValue('useFragHandler'))
}

function onLogin(cid)
local storage = 85712
local positions = {
            {x=1004, y=998, z=7},
            {x=1004, y=999, z=7},
            {x=1002, y=1003, z=7},
            {x=1001, y=1003, z=7},
            {x=1000, y=1003, z=7},
	     {x=999, y=1003, z=7} 
}

if(getPlayerStorageValue(cid, storage) < 1) then
    local position = positions[math.random(1, #positions)]
    doTeleportThing(cid, position)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
    setPlayerStorageValue(cid, storage, 1)
end 

	local loss = getConfigValue('deathLostPercent')
	if(loss ~= nil) then
		doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10)
	end

	local accountManager = getPlayerAccountManager(cid)
	if(accountManager == MANAGER_NONE) then
		local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage
		if(lastLogin > 0) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
			str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "."
		else
			str = str .. " Please choose your outfit."
			doPlayerSendOutfitWindow(cid)
		end

		doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str)
	elseif(accountManager == MANAGER_NAMELOCK) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?")
	elseif(accountManager == MANAGER_ACCOUNT) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.")
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.")
	end

	if(not isPlayerGhost(cid)) then
		doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
	end

	registerCreatureEvent(cid, "Mail")
	registerCreatureEvent(cid, "GuildMotd")

	registerCreatureEvent(cid, "Idle")
	if(config.useFragHandler) then
		registerCreatureEvent(cid, "SkullCheck")
	end
	registerCreatureEvent(cid, "ReportBug")
	registerCreatureEvent(cid, "level")
	return true
end

ale nie dziala, bledow nie ma w logach
 
Odp: logowanie

PHP:
local config = { 
    loginMessage = getConfigValue('loginMessage'), 
    useFragHandler = getBooleanFromString(getConfigValue('useFragHandler')) 
} 

function onLogin(cid) 
    local loss = getConfigValue('deathLostPercent') 
    if(loss ~= nil) then 
        doPlayerSetLossPercent(cid, PLAYERLOSS_EXPERIENCE, loss * 10) 
    end 

    local accountManager = getPlayerAccountManager(cid) 
    if(accountManager == MANAGER_NONE) then 
        local lastLogin, str = getPlayerLastLoginSaved(cid), config.loginMessage 
        if(lastLogin > 0) then 
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) 
            str = "Your last visit was on " .. os.date("%a %b %d %X %Y", lastLogin) .. "." 
        else 
            str = str .. " Please choose your outfit." 
            doPlayerSendOutfitWindow(cid) 
        end 
		local storage = 81732
		local positions = {
			{x = , y = , z = }, -- pozycja 1
			{x = , y = , z = }, -- pozycja 2
			{x = , y = , z = } -- pozycja 3
		}

		if(getPlayerStorageValue(cid, storage) < 1) then
			local position = positions[math.random(1, #positions)]
			doTeleportThing(cid, position)
			doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
			setPlayerStorageValue(cid, storage, 1)
		end
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, str) 
    elseif(accountManager == MANAGER_NAMELOCK) then 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, it appears that your character has been namelocked, what would you like as your new name?") 
    elseif(accountManager == MANAGER_ACCOUNT) then 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to manage your account and if you want to start over then type 'cancel'.") 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Hello, type 'account' to create an account or type 'recover' to recover an account.") 
    end 

    if(not isPlayerGhost(cid)) then 
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT) 
    end 

    registerCreatureEvent(cid, "Mail") 
    registerCreatureEvent(cid, "GuildMotd") 

    registerCreatureEvent(cid, "Idle") 
    if(config.useFragHandler) then 
        registerCreatureEvent(cid, "SkullCheck") 
    end 
    registerCreatureEvent(cid, "ReportBug") 
    registerCreatureEvent(cid, "level")   
    return true 
end
Tutaj zmieniasz pozycje:
PHP:
		local positions = {
			{x = , y = , z = }, -- pozycja 1
			{x = , y = , z = }, -- pozycja 2
			{x = , y = , z = } -- pozycja 3
		}
x,y,z - chyba wiesz o co chodzi, cu?;P

Notka moderatorska:
+1 OT Expert [Request]
 
Ostatnio edytowane przez moderatora:
Status
Zamknięty.
Back
Do góry