• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

[Need a fix] (internalGetPlayerInfo) Player not found when requesting player info #6

Shadow Dan

Sh4dowDan
Joined
Jun 5, 2010
Messages
344
Reaction score
90
Location
Poland
Hello,
When i am using the lever and there is no one at tiles, in my console get an error with this script.
This script works, but with that error when there is no one on tile.

Code:
[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #6

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3

[Error - Action Interface]
data/actions/scripts/quests/desert quest lever.lua:onUse
Description:
(internalGetPlayerInfo) Player not found when requesting player info #3

desert quest lever.lua
Code:
function onUse(cid, item, frompos, item2, topos)

    switchUniqueID = 16000
    switchID = 1945
    switch2ID = 1946
    swordID = 2376
    crossbowID = 2455
    appleID = 2674
    spellbookID = 2175

    questlevel = 20

    piece1pos = {x=1116, y=971, z=8, stackpos=1}
    getpiece1 = getThingfromPos(piece1pos)

    piece2pos = {x=1116, y=960, z=8, stackpos=1}
    getpiece2 = getThingfromPos(piece2pos)

    piece3pos = {x=1110, y=966, z=8, stackpos=1}
    getpiece3 = getThingfromPos(piece3pos)

    piece4pos = {x=1122, y=966, z=8, stackpos=1}
    getpiece4 = getThingfromPos(piece4pos)


    player1pos = {x=1116, y=970, z=8, stackpos=253}
    player1 = getThingfromPos(player1pos)

    player2pos = {x=1116, y=962, z=8, stackpos=253}
    player2 = getThingfromPos(player2pos)

    player3pos = {x=1112, y=966, z=8, stackpos=253}
    player3 = getThingfromPos(player3pos)

    player4pos = {x=1120, y=966, z=8, stackpos=253}
    player4 = getThingfromPos(player4pos)

    knightvoc = getPlayerVocation(player1.uid)
    paladinvoc = getPlayerVocation(player2.uid)
    druidvoc = getPlayerVocation(player3.uid)
    sorcerervoc = getPlayerVocation(player4.uid)

    nplayer1pos = {x=1115, y=947, z=8}
    nplayer2pos = {x=1114, y=946, z=8}
    nplayer3pos = {x=1114, y=947, z=8}
    nplayer4pos = {x=1115, y=946, z=8}

    player1level = getPlayerLevel(player1.uid)
    player2level = getPlayerLevel(player2.uid)
    player3level = getPlayerLevel(player3.uid)
    player4level = getPlayerLevel(player4.uid)

    if knightvoc == 4 or knightvoc == 8 and paladinvoc == 3 or paladinvoc == 7 and druidvoc == 2 or druidvoc == 6 and sorcerervoc == 1 or sorcerervoc == 5 then
        if player1.itemid > 0 and player2.itemid > 0 and player3.itemid > 0 and player4.itemid > 0 then
            if player1level >= questlevel and player2level >= questlevel and player3level >= questlevel and player4level >= questlevel then
                if item.uid == switchUniqueID and item.itemid == switchID and getpiece1.itemid == swordID and getpiece2.itemid == crossbowID and getpiece3.itemid == appleID and getpiece4.itemid == spellbookID then
                    doSendMagicEffect(player1pos, 2)
                    doTeleportThing(player1.uid, nplayer1pos)
                    doSendMagicEffect(nplayer1pos, 10)
                    doRemoveItem(getpiece1.uid, 1)

                    doSendMagicEffect(player2pos, 2)
                    doTeleportThing(player2.uid, nplayer2pos)
                    doSendMagicEffect(nplayer2pos, 10)
                    doRemoveItem(getpiece2.uid, 1)

                    doSendMagicEffect(player3pos, 2)
                    doTeleportThing(player3.uid, nplayer3pos)
                    doSendMagicEffect(nplayer3pos, 10)
                    doRemoveItem(getpiece3.uid, 1)

                    doSendMagicEffect(player4pos, 2)
                    doTeleportThing(player4.uid, nplayer4pos)  
                    doSendMagicEffect(nplayer4pos, 10)
                    doRemoveItem(getpiece4.uid, 1)

                    doTransformItem(item.uid, item.itemid + 1)
                elseif item.uid == switchUniqueID and item.itemid == switch2ID then
                    doTransformItem(item.uid, item.itemid - 1)
                else
                    doPlayerSendCancel(cid, "Sorry, you need to put the correct stuffs at the correct basins.")
                end
            else
                doPlayerSendCancel(cid, "Sorry, all players in your team must to be level " .. questlevel .. ".")
            end
        else
            doPlayerSendCancel(cid, "Sorry, all 4 players must be on right positions.")
        end
    else
        doPlayerSendCancel(cid, "Sorry, all 4 players must be on right positions.")
    end
return true
end

 
Last edited:
1. use tab instead of spacebars
2. use locals
3. use [ lua ] instead of [ code ]
4. use loops and tables if possible
5. use () if need becouse:
LUA:
5-3+2
is not the same as
LUA:
5-(3+2)
same thing is wth or/and
LUA:
if xxxx or yyyy and zzzz then
is not the same as
LUA:
if xxxx or (yyyy and zzzz) then

here is the script editted by me
LUA:
function onUse(cid, item, frompos, item2, topos)
	local questlevel = 20
	local cancels = {
		[1] = "Sorry, all 4 players have to be on right positions.",
		[2] = "Sorry, all players have to be atleast level " .. questlevel .. ".",
		[3] = "Sorry, you need to put the correct items on the correct basins."
	}
	local piecepos = {
		[1] = {x=1116, y=971, z=8, stackpos=1},
		[2] = {x=1116, y=960, z=8, stackpos=1},
		[3] = {x=1110, y=966, z=8, stackpos=1},
		[4] = {x=1122, y=966, z=8, stackpos=1}
	}
	local playerpos = {
		[1] = {x=1116, y=970, z=8, stackpos=253},
		[2] = {x=1116, y=962, z=8, stackpos=253},
		[3] = {x=1112, y=966, z=8, stackpos=253},
		[4] = {x=1120, y=966, z=8, stackpos=253}
	}
	local pieceID = {
		[1] = 2376,
		[2] = 2455,
		[3] = 2674,
		[4] = 2175
	}
	local nplayerpos = {
		[1] = {x=1115, y=947, z=8}
		[2] = {x=1114, y=946, z=8}
		[3] = {x=1114, y=947, z=8}
		[4] = {x=1115, y=946, z=8}
	}
	
	for g = 1, 4 do
		getpiece[g] = getThingfromPos(piecepos[g])
		playervoc[g] = getPlayerVocation(getThingfromPos(playerpos[g]).uid)
	end


	local check = 0
	local vocnormal = 4
	local vocpromot = 8
	for t = 1,4 do
		if ((playervoc[t] == vocnormal) or (playervoc[t] == vocpromot)) then
			if getPlayerLevel(getThingfromPos(playerpos[t]).uid) >= 20 then
				if getThingfromPos(playerpos[t]).itemid > 0 then
					if (getpiece[t].itemid == pieceID[t]) then
						check = check + 1
					else
						break
						cancel = cancels[3]
					end
				end
			else
				break
				cancel = cancels[2]
			end
		else
			break
			cancel = cancels[1]
		end
		vocnormal = vocnormal - 1
		vocpromot = vocpromot - 1
	end
	
	if item.uid == 16000 and item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	elseif item.uid == 16000 and item.itemid == 1945 then
		if check == 4 then
			for r = 1, 4 do	
				doSendMagicEffect(playerpos[r], 2)
				doTeleportThing(getThingfromPos(playerpos[r]).uid, nplayerpos[r])
				doSendMagicEffect(nplayerpos[r], 10)
				doRemoveItem(getpiece[r].uid, 1)
			end
			doTransformItem(item.uid, item.itemid + 1)
		else
			doPlayerSendCancel(cid, cancel)
		end
	end
return true
end
 
Last edited:
Code:
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/quests/desert quest lever.lua)
data/actions/scripts/quests/desert quest lever.lua:50: 'end' expected (to close 'if' at line 46) near 'cancel'
LUA:
function onUse(cid, item, frompos, item2, topos)
	local questlevel = 20
	local cancels = {
		[1] = "Sorry, all 4 players have to be on right positions.",
		[2] = "Sorry, all players have to be atleast level " .. questlevel .. ".",
		[3] = "Sorry, you need to put the correct items on the correct basins."
	}
	local piecepos = {
		[1] = {x=1116, y=971, z=8, stackpos=1},
		[2] = {x=1116, y=960, z=8, stackpos=1},
		[3] = {x=1110, y=966, z=8, stackpos=1},
		[4] = {x=1122, y=966, z=8, stackpos=1}
	}
	local playerpos = {
		[1] = {x=1116, y=970, z=8, stackpos=253},
		[2] = {x=1116, y=962, z=8, stackpos=253},
		[3] = {x=1112, y=966, z=8, stackpos=253},
		[4] = {x=1120, y=966, z=8, stackpos=253}
	}
	local pieceID = {
		[1] = 2376,
		[2] = 2455,
		[3] = 2674,
		[4] = 2175
	}
	local nplayerpos = {
		[1] = {x=1115, y=947, z=8},
		[2] = {x=1114, y=946, z=8},
		[3] = {x=1114, y=947, z=8},
		[4] = {x=1115, y=946, z=8}
	}
 
	for g = 1, 4 do
		getpiece[g] = getThingfromPos(piecepos[g])
		playervoc[g] = getPlayerVocation(getThingfromPos(playerpos[g]).uid)
	end
 
 
	local check = 0
	local vocnormal = 4
	local vocpromot = 8
	for t = 1,4 do
		if ((playervoc[t] == vocnormal) or (playervoc[t] == vocpromot)) then
			if getPlayerLevel(getThingfromPos(playerpos[t]).uid) >= 20 then
				if getThingfromPos(playerpos[t]).itemid > 0 then
					if (getpiece[t].itemid == pieceID[t]) then
						check = check + 1
					else
						break
						cancel = cancels[3]
					end
				end
			else
				break
				cancel = cancels[2]
			end
		else
			break
			cancel = cancels[1]
		end
		vocnormal = vocnormal - 1
		vocpromot = vocpromot - 1
	end
 
	if item.uid == 16000 and item.itemid == 1946 then
		doTransformItem(item.uid, item.itemid - 1)
	elseif item.uid == 16000 and item.itemid == 1945 then
		if check == 4 then
			for r = 1, 4 do	
				doSendMagicEffect(playerpos[r], 2)
				doTeleportThing(getThingfromPos(playerpos[r]).uid, nplayerpos[r])
				doSendMagicEffect(nplayerpos[r], 10)
				doRemoveItem(getpiece[r].uid, 1)
			end
			doTransformItem(item.uid, item.itemid + 1)
		else
			doPlayerSendCancel(cid, cancel)
		end
	end
return true
end
 
~refresh

#edit
if someone need this, here is a good script
LUA:
function onUse(cid, item, frompos, item2, topos)
    local questlevel = 20
    local cancels = {
        [1] = "Wszyscy 4 gracze musza byc na wlasciwych pozycjach.",
        [2] = "Wszyscy gracze musza miec co najmniej " .. questlevel .. " lvl.",
        [3] = "Musisz polozyc wlasciwe przedmioty na wlasciwych miejscach."
    }
    local piecepos = {
        [1] = {x=1116, y=971, z=8, stackpos=1}, -- Sword - poludnie \/ -- pozycje gdzie trzeba polozyc przedmioty
        [2] = {x=1116, y=960, z=8, stackpos=1}, -- Crossbow - polnoc /\
        [3] = {x=1110, y=966, z=8, stackpos=1}, -- Red apple - zachod <--
        [4] = {x=1122, y=966, z=8, stackpos=1}  -- Spellbook - wschod -->
    }
    local playerpos = {
        [1] = {x=1116, y=970, z=8, stackpos=253}, -- Knight -- pozycje gdzie maja stanac gracze
        [2] = {x=1116, y=962, z=8, stackpos=253}, -- Paladin
        [3] = {x=1112, y=966, z=8, stackpos=253}, -- Druid
        [4] = {x=1120, y=966, z=8, stackpos=253}  -- Sorcerer
    }
    local pieceID = {
        [1] = 2376, -- Sword -- itemid przedmiotow, ktore trzeba polozyc na basinach
        [2] = 2455, -- Crossbow
        [3] = 2674, -- Red apple
        [4] = 2175  -- Spellbook
    }
    local nplayerpos = {
        [1] = {x=1115, y=947, z=8}, -- Knight -- pozycje gdzie ma teleportowac po przekreceniu dzwigni
        [2] = {x=1114, y=946, z=8}, -- Paladin
        [3] = {x=1114, y=947, z=8}, -- Druid
        [4] = {x=1115, y=946, z=8}  -- Sorcerer
    }
 
    playervoc, getpiece = {},{}
    for g = 1, 4 do
        getpiece[g] = getThingfromPos(playerpos[g])
        if isPlayer(getpiece[g].uid) then
            playervoc[g] = getPlayerVocation(getpiece[g].uid)
        end
    end
 
    local check = 0
    local vocnormal = 4
    local vocpromot = 8
   
    for t = 1,4 do
        getpiece[t] = getThingfromPos(piecepos[t])
        if ((playervoc[t] == vocnormal) or (playervoc[t] == vocpromot)) then
            if getPlayerLevel(getThingfromPos(playerpos[t]).uid) >= 20 then
                if getThingfromPos(playerpos[t]).itemid > 0 then
                    if (getpiece[t].itemid == pieceID[t]) then
                        check = check + 1
                    else
                        cancel = cancels[3]
                         break
                    end
                end
            else
                cancel = cancels[2]
                break
            end
        else
            cancel = cancels[1]
            break
        end
        vocnormal = vocnormal - 1
        vocpromot = vocpromot - 1
    end
 
    if item.uid == 16000 and item.itemid == 1946 then
        doTransformItem(item.uid, item.itemid - 1)
    elseif item.uid == 16000 and item.itemid == 1945 then
        if check == 4 then
            for r = 1, 4 do
                doSendMagicEffect(playerpos[r], 2)
                doTeleportThing(getThingfromPos(playerpos[r]).uid, nplayerpos[r])
                doSendMagicEffect(nplayerpos[r], 10)
                doRemoveItem(getpiece[r].uid, 1)
            end
            doTransformItem(item.uid, item.itemid + 1)
        else
            doPlayerSendCancel(cid, cancel)
        end
    end
return true
end
 
Back
Top