Jump to content

مشكلة x2


DaHoM

Recommended Posts

مشكلتي المرة ذي بسيطة 

يقلي 

Error :- bad argument #1 to 'gsub' (string expected, got nill)

function convertNumber(number)  
	local formatted = number  
	while true do      
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
		if (k==0) then      
			break   
		end  
	end  
	return formatted
end

 

Edited by DaHoM
Link to comment

اطرح اكوادك في المكان الي استخدمت فيه هذا الفنكشن +

عدل الفنكشن الى كذا ومابيجيك اخطاء:

function convertNumber(number)  
    local formatted = (number and type(number)=='number')and number or 0
    while true do      
        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
        if (k==0) then      
            break   
        end  
    end  
    return formatted
end

 

Edited by #,+( _xiRoc[K]; >
Link to comment

function A()
        dxDrawFramedText("Your Point : ( " ..convertNumber(getElementData(localPlayer,"Day"))..  " )    ||    Your Points : ( " ..convertNumber(getElementData(localPlayer,"Day")).. " ) ", screenW * 0.0154, screenH * 0.4896, screenW * 0.2160, screenH * 0.5104, tocolor(0, 255, 50, 255), 0.95, "sans", "left", "top", false, false, false, false, false)
end


function AB()
        dxDrawFramedText("Your Point : ( " ..convertNumber(getElementData(localPlayer,"Days"))..  " )    ||    Your Points : ( " ..convertNumber(getElementData(localPlayer,"Days")).. " ) ", screenW * 0.0154, screenH * 0.4896, screenW * 0.2160, screenH * 0.5104, tocolor(0, 255, 50, 255), 0.95, "sans", "left", "top", false, false, false, false, false)
end

function ABC()
if getElementData(localPlayer,"LoginTopDay") then
for i, valueT in ipairs(PointGang) do
        dxDrawFramedText("Best Point: "..valueT[1].. " ("..convertNumber(valueT[2])..")", screenW * 0.0154, screenH * 0.3997, screenW * 0.1398, screenH * 0.4258, tocolor(255, 0, 0, 255), 1.00, "sans", "left", "top", false, false, false, false, false)
PlayerBestG = valueT[1]
end
end
end

function ABCD()
if getElementData(localPlayer,"LoginTopDays") then
for i, valueT in ipairs(PointPolice) do
        dxDrawFramedText("Best Point : "..valueT[1].. " ("..convertNumber(valueT[2])..")", screenW * 0.0154, screenH * 0.4388, screenW * 0.1398, screenH * 0.4648, tocolor(0, 0, 255, 255), 1.00, "sans", "left", "top", false, false, false, false, false)
PlayerBestP = valueT[1]
end
end
end

 

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...