Jump to content

Help Please!


Annas

Recommended Posts

Posted

Hey all.

I have a problem on this code:

function downloadPlayerAlternateSkin (p, _) 
    local filename = exports.CSTmysql:query("SELECT * FROM Skins") 
    for i=1, #filename do 
    local theskinId = filename[i].skinid 
    outputDebugString("filename[i] = ".. tostring(filename[i])) 
    if theskinId then 
        fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) 
    end 
    end 
end 
addCommandHandler("addskin", downloadPlayerAlternateSkin) 

Console: INFO: filename = table: 0xa9a3b40

Also it makes server lag (NETWORK TROUBLE) for 1min everytime i use that command '/addskin'.

Maybe there is something wrong on my function.. please help me

Posted

Well, how much skins do you have in your database?

If you have 100 skins, then you will make 100 requests to your webserver via fetchRemote

Sometimes I dream about cheese

Posted
100 requests to your webserver via fetchRemote

Are you serious ?

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted
    function downloadPlayerAlternateSkin (p, _) 
        local filename = exports.CSTmysql:query("SELECT * FROM Skins") 
        for i=1, #filename do 
        local theskinId = filename[i].skinid 
        outputDebugString("filename[i] = ".. tostring(filename[i].skinid)) -- Not sure if this was what you intended to do, but here it was outputting a table as the string. 
  
        if theskinId then 
            fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) 
        end 
        end 
    end 
    addCommandHandler("addskin", downloadPlayerAlternateSkin) 

Not sure if that's what you were trying to do, but some times small errors such as that will indeed freeze up the server.

Wolf Inc Discord

Youtube channel
Github

Posted
    function downloadPlayerAlternateSkin (p, _) 
        local filename = exports.CSTmysql:query("SELECT * FROM Skins") 
        for i=1, #filename do 
        local theskinId = filename[i].skinid 
        outputDebugString("filename[i] = ".. tostring(filename[i].skinid)) -- Not sure if this was what you intended to do, but here it was outputting a table as the string. 
  
        if theskinId then 
            fetchRemote("http://localhost/shadersqsdqs/"..theskinId..".jpg", checkPlayerAlternateSkinONLOGIN) 
        end 
        end 
    end 
    addCommandHandler("addskin", downloadPlayerAlternateSkin) 

Not sure if that's what you were trying to do, but some times small errors such as that will indeed freeze up the server.

Not working :(

ScreenShot:

TsxpOds.png

Debugscript:

Line 5: Attempt to concatenate local 'theskinId' (a nil value)

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