Jump to content

[HELP] string.upper Error


Recommended Posts

fr_client.lua:1231:Bad argumant #1 to 'upper' (string expected, got boolean)

 

Line 1231:      if ( string.find ( string.upper ( getPlayerName(elem) ), string.upper ( isim ), 1, true ) ) then

 

function updatePlayerBlips()
	if not g_PlayerData then
		return
	end
	local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos
	local mapControl = getControl(wnd, 'map')
	for elem,player in pairs(g_PlayerData) do
		if not player.gui.mapBlip then
			player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'dosyalar/resim/localplayerblip.png' or 'dosyalar/resim/playerblip.png', false, mapControl)
			player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name:gsub("#%x%x%x%x%x%x",""), false, mapControl)
			local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow)
			guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false)
			guiSetFont(player.gui.mapLabelShadow, 'default-bold-small')
			guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255)
			player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name:gsub("#%x%x%x%x%x%x",""), false, mapControl)
			guiSetFont(player.gui.mapLabel, 'default-bold-small')				
			for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do
				addEventHandler('onClientGUIDoubleClick', player.gui[name],
					function()
					if getElementDimension(elem)==0 and getElementData(elem,"Warp")==false then					
						server.warpMe(elem)
						closeWindow(wnd)
					else
					    errMsg("Işınlandığın Oyuncu Işınlanma Özelliğini Kapatmış Durumda (/isinlanma)")
					end
					end,
					false
				)
			end
		end
		local x, y = getElementPosition(elem)
		x = math.floor((x + 3000) * g_MapSide / 6000) - 4
		y = math.floor((3000 - y) * g_MapSide / 6000) - 4
		guiSetPosition(player.gui.mapBlip, x, y, false)
		guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false)
		guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false)
        if getElementDimension(elem)~=0 then	
		guiSetPosition(player.gui.mapBlip, -500, -500, false)
		guiSetPosition(player.gui.mapLabelShadow, -500, -500, false)
		guiSetPosition(player.gui.mapLabel, -500, -500, false)		
        end
		local isim = getControlText(wndSetPos,"isim")
		if ( string.find ( string.upper ( getPlayerName(elem) ), string.upper ( isim ), 1, true ) ) then		
			else
		if isim~="Oyuncu Ara.." then
		guiSetPosition(player.gui.mapBlip, -500, -500, false)
		guiSetPosition(player.gui.mapLabelShadow, -500, -500, false)
		guiSetPosition(player.gui.mapLabel, -500, -500, false)
        end		
		end
			if getElementData(elem,"Warp")==true then
			    guiLabelSetColor(player.gui.mapLabel, 255, 0, 0)		
			end
			if getElementData(elem,"Warp")==false then
			    guiLabelSetColor(player.gui.mapLabel, 0, 0, 0)		
			end			
	end
end

I can not solve this error If you know, show me the solution ? :(

Link to comment


    function updatePlayerBlips()
    	if not g_PlayerData then
    		return
    	end
    	local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos
    	local mapControl = getControl(wnd, 'map')
    	for elem,player in pairs(g_PlayerData) do
    		if not player.gui.mapBlip then
    			player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'dosyalar/resim/localplayerblip.png' or 'dosyalar/resim/playerblip.png', false, mapControl)
    			player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name:gsub("#%x%x%x%x%x%x",""), false, mapControl)
    			local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow)
    			guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false)
    			guiSetFont(player.gui.mapLabelShadow, 'default-bold-small')
    			guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255)
    			player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name:gsub("#%x%x%x%x%x%x",""), false, mapControl)
    			guiSetFont(player.gui.mapLabel, 'default-bold-small')				
    			for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do
    				addEventHandler('onClientGUIDoubleClick', player.gui[name],
    					function()
    					if getElementDimension(elem)==0 and getElementData(elem,"Warp")==false then					
    						server.warpMe(elem)
    						closeWindow(wnd)
    					else
    					    errMsg("Işınlandığın Oyuncu Işınlanma Özelliğini Kapatmış Durumda (/isinlanma)")
    					end
    					end,
    					false
    				)
    			end
    		end
    		local x, y = getElementPosition(elem)
    		x = math.floor((x + 3000) * g_MapSide / 6000) - 4
    		y = math.floor((3000 - y) * g_MapSide / 6000) - 4
    		guiSetPosition(player.gui.mapBlip, x, y, false)
    		guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false)
    		guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false)
            if getElementDimension(elem)~=0 then	
    		guiSetPosition(player.gui.mapBlip, -500, -500, false)
    		guiSetPosition(player.gui.mapLabelShadow, -500, -500, false)
    		guiSetPosition(player.gui.mapLabel, -500, -500, false)		
            end
    		local isim = getControlText(wndSetPos,"isim")
    		if ( string.find ( string.upper ( getPlayerName(elem) or '' ), string.upper ( isim or '' ), 1, true ) ) then		
    			else
    		if isim~="Oyuncu Ara.." then
    		guiSetPosition(player.gui.mapBlip, -500, -500, false)
    		guiSetPosition(player.gui.mapLabelShadow, -500, -500, false)
    		guiSetPosition(player.gui.mapLabel, -500, -500, false)
            end		
    		end
    			if getElementData(elem,"Warp")==true then
    			    guiLabelSetColor(player.gui.mapLabel, 255, 0, 0)		
    			end
    			if getElementData(elem,"Warp")==false then
    			    guiLabelSetColor(player.gui.mapLabel, 0, 0, 0)		
    			end			
    	end
    end

 

If you get an error like this you need to ensure to add an or modifier so that if the string does not exist it'll default to a blank string.

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...