What's new

GM nie moze /goto to danego nicku

Status
Not open for further replies.

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
witam,
potrzebuje aby ktos przeedytowal mi skrypt,
chce zeby GM (CM ewentualnie tez) nie mogl sie telepostowac do gracza o nicku naprzyklad "alex"
ale zeby god mogl normalnie ^^.

oto normalny 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



za pomoc rep ;)
 

Yoke1

Active User
Joined
Dec 13, 2009
Messages
124
Reaction score
9
Odp: GM nie moze /goto to danego nicku

Hehehe problem nie tkwi w skypcie tylko w talkactions.xml albo raczej nie ma ?adnego problemu :D
w
data\talkactions\talkactions.xml
wpisz:
<talkaction log="yes" words="/goto" access="3" event="script" value="nazwa skrypta.lua" />
Obja?nienie access
access="0" - wszyscy ??cznie z playerem
access="1" - dla Tutor i up
access="2" - dla ST i up
access="3" - dla GM i up
access="4"- dla CM i up
access="5" - dla GOD
 

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
Odp: GM nie moze /goto to danego nicku

ale ja chce zeby gm mogl do wszystkich dawac tp
ale tylko nie dla nicku alex.
 

Aratos

Active User
Joined
Jan 9, 2010
Messages
97
Reaction score
7
Odp: GM nie moze /goto to danego nicku

Nie Rozumie? cie? mowisz ze tylko GoD ma Miec /goto? wiec w czym problem?
 

andy1995

Senior User
Joined
Apr 12, 2009
Messages
602
Reaction score
100
Odp: GM nie moze /goto to danego nicku

Sprawdz
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]} 
	elseif(getCreatureByName(param) == "Alex") then
		return false
    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
 

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
Odp: GM nie moze /goto to danego nicku

@Aratos
mowie o tym ze tylko GoD mogl by sie teleportowac do gracza o nicku alex
nikt wiecej.

dalej GM moze sie teleportowac do gracza o nicku "Alex",
prosze o pomoc, jest mi to pillnie potrzebne.
 

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: GM nie moze /goto to danego nicku

Code:
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]} 
    elseif(getCreatureByName(param) ~= "Alex") then
        return false
    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
 

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
Odp: GM nie moze /goto to danego nicku

noo elegencko , dziala!
;*,
rep dla ciebie

@edit
jest jak,
jak sie pomyle w wpisywaniu nicku lub postac sie offline to wyswietla mi sie na zolto (tak jak bym normalnie pisal) /goto (nick)
mozesz to skorygowac ?
 
Last edited:

Xayan

Senior User
Joined
Jul 4, 2009
Messages
2,608
Reaction score
390
Age
28
Odp: GM nie moze /goto to danego nicku

Wszystkie return true w skrypcie zamie? na return false.
 

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
Odp: GM nie moze /goto to danego nicku

zrobilem tak i nie dziala poprawnie
 

orzeleagle122

Advanced User
Joined
May 18, 2010
Messages
449
Reaction score
16
Odp: GM nie moze /goto to danego nicku

mozesz poprawic bo nie dziala teraz wgl...
mozesz zrobic tak jak jak chce sie do tego nicku tp to zeby dawalo go na pozycje 1000/1000/7 lub do temple.
mozesz zrobic tak nawet god nie bedzie mogl sie teleportowac jak bedzie ci latwiej
 
Last edited:
Status
Not open for further replies.
Top