Jump to content

I have a problem with this command


Harvey

Recommended Posts

function setPlayerSkin2(thePlayer, commandName, targetPlayer, skin)
    if (tonumber(getElementData(thePlayer, "acc:admin") or 0) >= 1) then
        
        if not (targetPlayer) or not (skin) then
            outputChatBox("#7cc576Használat:#ffffff /" .. commandName .. " [Név / ID] [Skin ID]", thePlayer, 255, 255, 255, true)
        else
        
            local targetPlayer, targetPlayerName = exports.san_core:findPlayer(thePlayer, targetPlayer)
            local skin = tonumber(skin)
            if not (targetPlayer) then outputChatBox(error .. "Nincs ilyen játékos.", thePlayer, 255, 255, 255, true) return end
            
            if getElementModel(targetPlayer) == skin then
                outputChatBox(error .. "A játékoson már ez a skin van.", thePlayer, 255, 255, 255, true)
                return
            end
            
            if setElementModel(targetPlayer, skin) then
                outputChatBox("Sikeresen megváltoztattad #7cc576" .. targetPlayerName:gsub("_"," ") .. "#ffffff skinjét. #7cc576(" .. skin .. ")", thePlayer, 255, 255, 255, true)
                dbExec(con, "UPDATE characters SET skin = ? WHERE ID = ?",skin,getElementData(targetPlayer, "acc:id"))
            else
                outputChatBox(error .. "Nem sikerült megváltoztatni #7cc576" .. targetPlayerName:gsub("_"," ") .. "#ffffff skinjét. Hibakód: SSKIN1", thePlayer, 255, 255, 255, true)
            end
        end
    end
end
addCommandHandler("setskin", setPlayerSkin2, false, false)

So I have this command made but its not working. I checked everything most of the commands are working fine but this one just refuse to do anything. (It doesnt give any error code in the console)

Link to comment
function setPlayerSkin2(thePlayer, commandName, targetPlayerName, skin)
    if (tonumber(getElementData(thePlayer, "acc:admin") or 0) >= 1) then
        
        if not (getPlayerFromName(targetPlayerName)) or not (tonumber(skin)) then
            outputChatBox("#7cc576Használat:#ffffff /" .. commandName .. " [Név / ID] [Skin ID]", thePlayer, 255, 255, 255, true)
        else
        
            local targetPlayer, targetPlayerName = exports.san_core:findPlayer(thePlayer, targetPlayer)
            local skin = tonumber(skin)
            if not (targetPlayer) then outputChatBox(error .. "Nincs ilyen játékos.", thePlayer, 255, 255, 255, true) return end
            
            if getElementModel(targetPlayer) == skin then
                outputChatBox(error .. "A játékoson már ez a skin van.", thePlayer, 255, 255, 255, true)
                return
            end
            
            if setElementModel(targetPlayer, skin) then
                outputChatBox("Sikeresen megváltoztattad #7cc576" .. targetPlayerName:gsub("_"," ") .. "#ffffff skinjét. #7cc576(" .. skin .. ")", thePlayer, 255, 255, 255, true)
                dbExec(con, "UPDATE characters SET skin = ? WHERE ID = ?",skin,getElementData(targetPlayer, "acc:id"))
            else
                outputChatBox(error .. "Nem sikerült megváltoztatni #7cc576" .. targetPlayerName:gsub("_"," ") .. "#ffffff skinjét. Hibakód: SSKIN1", thePlayer, 255, 255, 255, true)
            end
        end
    end
end
addCommandHandler("setskin", setPlayerSkin2, false, false)

 

 

Hello

here is your code , Problem solved - setskin PlayerNick SkinID

Cheers !

Edited by #!_A7M8D
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...