What's new

GM nie moze tp do "Ola"

Status
Not open for further replies.

orzeleagle

User
Joined
Mar 12, 2010
Messages
45
Reaction score
1
siema,
mam takie pytanie,
jak zrobic zeby GM (game-master) nie mogl sie teleportowac konkretnie do gracz o nicku "ola". zak?adaj?c ze GM ma caly czas wlaczonego /ghost -dla ulatwienia.
albo naprzyklad zeby jak wpisze /goto ola to zeby na zolto sie wyswietlilo, albo co kolwiek, wazne zeby nie mogl sie do Ola teleportowac. hmm.. moze dawac naprzyklad do temple,
moze byc kazde rozwiazanie, byle tylko GM sie do tego gracza nie teleportowal.

za pomoc rep !!

skrypt na /goto:

PHP:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end

	local creature = getCreatureByName(param)
	local player = getPlayerByNameWildcard(param)
	local waypoint = getWaypointPosition(param)
	local tile = string.explode(param, ",")
	local pos = {x = 0, y = 0, z = 0}

	if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then
		pos = getCreaturePosition(player)
	elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then
		pos = getCreaturePosition(creature)
	elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then
		pos = waypoint
	elseif(tile[2] and tile[3]) then
		pos = {x = tile[1], y = tile[2], z = tile[3]}
	else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.")
		return true
	end

	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.")
		return true
	end

	pos = getClosestFreeTile(cid, pos, true, false)
	if(not pos or isInArray({pos.x, pos.y}, 0)) then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.")
		return true
	end

	local tmp = getCreaturePosition(cid)
	if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then
		doSendMagicEffect(tmp, CONST_ME_POFF)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
	end

	return true
end
 

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: GM nie moze tp do "Ola"

Czyli GM nie mo?e si? teleportowa? do gracza imieniem Ola? Dobrze zrozumia?em?
Zaraz pod funkcj? dodaj:
PHP:
if param ~= "ola" then
dalsza cz??? skryptu
end
 

orzeleagle

User
Joined
Mar 12, 2010
Messages
45
Reaction score
1
Odp: GM nie moze tp do "Ola"

to nie dziala:
PHP:
function onSay(cid, words, param, channel)
	if(param == '') then
	if param ~= "ola" then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
i to tez :
PHP:
function onSay(cid, words, param, channel)
	if(param == '') then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
	if param ~= "ola" then
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.")
		return true
	end
 
Last edited:

Oskar

Forum friend
Joined
Jan 24, 2009
Messages
2,256
Reaction score
331
Odp: GM nie moze tp do "Ola"

PHP:
function onSay(cid, words, param, channel) 
if param ~= "ola" then
    if(param == '') then 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command requires param.") 
        return true 
    end 

    local creature = getCreatureByName(param) 
    local player = getPlayerByNameWildcard(param) 
    local waypoint = getWaypointPosition(param) 
    local tile = string.explode(param, ",") 
    local pos = {x = 0, y = 0, z = 0} 

    if(player ~= nil and (not isPlayerGhost(player) or getPlayerGhostAccess(player) <= getPlayerGhostAccess(cid))) then 
        pos = getCreaturePosition(player) 
    elseif(creature ~= nil and (not isPlayer(creature) or (not isPlayerGhost(creature) or getPlayerGhostAccess(creature) <= getPlayerGhostAccess(cid)))) then 
        pos = getCreaturePosition(creature) 
    elseif(type(waypoint) == 'table' and waypoint.x ~= 0 and waypoint.y ~= 0) then 
        pos = waypoint 
    elseif(tile[2] and tile[3]) then 
        pos = {x = tile[1], y = tile[2], z = tile[3]} 
    else 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Invalid param specified.") 
        return true 
    end 

    if(not pos or isInArray({pos.x, pos.y}, 0)) then 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Destination not reachable.") 
        return true 
    end 

    pos = getClosestFreeTile(cid, pos, true, false) 
    if(not pos or isInArray({pos.x, pos.y}, 0)) then 
        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Cannot perform action.") 
        return true 
    end 

    local tmp = getCreaturePosition(cid) 
    if(doTeleportThing(cid, pos, true) and not isPlayerGhost(cid)) then 
        doSendMagicEffect(tmp, CONST_ME_POFF) 
        doSendMagicEffect(pos, CONST_ME_TELEPORT) 
    end 
end
    return true 
end
 

orzeleagle

User
Joined
Mar 12, 2010
Messages
45
Reaction score
1
Odp: GM nie moze tp do "Ola"

thx
o to chodzilo, przerobilem sobie jeszcze kilka zeby tak zeby nie mogli np wpisac /goto ol~
dzieki za pomoc, rep dla ciebie
 
Status
Not open for further replies.
Top