Jump to content

Why not work?


Tomek123

Recommended Posts

OMG i try make skin saver and don't work again ! :cry:

What is wrong :cry:

function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            clothes = getPedClothes" class="kw2">getPedClothes(source,"PlayerClothes") 
            setAccountData ( playeraccount, "play.clothes", playerclothes ) 
      end 
end 
  
function onPlayerJoin ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            local playerclothes = getAccountData ( playeraccount, "play.clothes" ) 
            if ( playerclothes ) then 
            setPedClothes ( source, "PlayerClothes", clothes ) 
            end 
      end 
end 
  
addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) 
addEventHandler ( "onPlayerJoin", getRootElement ( ), onPlayerJoin ) 

i don't see any error, try /debugscript 3

Link to comment
  • Replies 104
  • Created
  • Last Reply

Top Posters In This Topic

Are you blind AcitanoX?

clothes = getPedClothes(source,"PlayerClothes")

"PlayerClothes"? WTF?

https://wiki.multitheftauto.com/wiki/GetPedClothes

this requires a type of clothes, types:

    *  0: SHIRT 
    * 1: HEAD 
    * 2: TROUSERS 
    * 3: SHOES 
    * 4: TATTOOS_LEFT_UPPER_ARM 
    * 5: TATTOOS_LEFT_LOWER_ARM 
    * 6: TATTOOS_RIGHT_UPPER_ARM 
    * 7: TATTOOS_RIGHT_LOWER_ARM 
    * 8: TATTOOS_BACK 
    * 9: TATTOOS_LEFT_CHEST 
    * 10: TATTOOS_RIGHT_CHEST 
    * 11: TATTOOS_STOMACH 
    * 12: TATTOOS_LOWER_BACK 
    * 13: NECKLACE 
    * 14: WATCH 
    * 15: GLASSES 
    * 16: HAT 
    * 17: EXTRA  

so should be:

function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            clothes = getPedClothes" class="kw2">getPedClothes(source,1) 
            setAccountData ( playeraccount, "play.clothes.head", playerclothes ) 
      end 
end 
addEventHandler("onPlayerQuit",getRootElement(),onPlayerQuit) 

and to load it when login do:

addPedClothes: https://wiki.multitheftauto.com/wiki/AddPedClothes

Link to comment
Are you blind AcitanoX?

clothes = getPedClothes(source,"PlayerClothes")

"PlayerClothes"? WTF?

https://wiki.multitheftauto.com/wiki/GetPedClothes

this requires a type of clothes, types:

    *  0: SHIRT 
    * 1: HEAD 
    * 2: TROUSERS 
    * 3: SHOES 
    * 4: TATTOOS_LEFT_UPPER_ARM 
    * 5: TATTOOS_LEFT_LOWER_ARM 
    * 6: TATTOOS_RIGHT_UPPER_ARM 
    * 7: TATTOOS_RIGHT_LOWER_ARM 
    * 8: TATTOOS_BACK 
    * 9: TATTOOS_LEFT_CHEST 
    * 10: TATTOOS_RIGHT_CHEST 
    * 11: TATTOOS_STOMACH 
    * 12: TATTOOS_LOWER_BACK 
    * 13: NECKLACE 
    * 14: WATCH 
    * 15: GLASSES 
    * 16: HAT 
    * 17: EXTRA  

so should be:

function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            clothes = getPedClothes" class="kw2">getPedClothes(source,1) 
            setAccountData ( playeraccount, "play.clothes.head", playerclothes ) 
      end 
end 
addEventHandler("onPlayerQuit",getRootElement(),onPlayerQuit) 

and to load it when login do:

addPedClothes: https://wiki.multitheftauto.com/wiki/AddPedClothes

I already explained, check my post on top. :P

Link to comment

Again somthing wrong :cry:

function onPlayerJoin ( ) 
      local playeraccount = getPlayerAccount ( source ) 
            clothes = getPedClothes" class="kw2">getPedClothes(source,0) 
    end 
end      
addEventHandler ( "onPlayerJoin", getRootElement(), onPlayerJoin ) 
  
function onPlayerQuit ( ) 
      local playeraccount = getPlayerAccount ( source ) 
      if ( playeraccount ) then 
            clothes = getPedClothes" class="kw2">getPedClothes(source,0) 
            setAccountData ( playeraccount, "play.clothes.shirt", playerclothes ) 
    end 
end 
addEventHandler ( "onPlayerQuit", getRootElement(), onPlayerQuit ) 

Link to comment

Try this:

function onPlayerQuitSaveClothes() 
local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        setAccountData(playeracc, "player.clothes", getPedClothes" class="kw2">getPedClothes(source, 0)) 
    end 
end 
  
function onPlayerJoinSaveClothes() 
local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
    local clothes = getAccountData(playeracc, "player.clothes") 
        if (clothes) then 
            addPedClothes(source, clothes) 
        end 
    end 
end 
  
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 
addEventHandler("onPlayerJoin", root, onPlayerJoinSaveClothes) 

Small note: Didn't wanted to put lua code because it gives "class = kw2" bugs.

Edited by Guest
Link to comment

This could be an example for your clothes saver.

local acc = getPlayerAccount(thePlayer) 
if acc then 
    for i=0,17 do 
        local texture, model = getPedClothe(thePlayer) 
        if texture and model then 
            setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) 
            setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) 
        end 
    end 
end 
  

(Rename getPedClothe = getPedClothes)

Clothes will be saved like this:

clothes.0.texture

clothes.0.model

clothes.1.texture

clothes.1.model

...

I didn't do the loader, you can do that one yourself

Link to comment
function onPlayerQuitSaveClothes() 
local playeracc = getPlayerAccount(source) 
    if (playeracc) then 
        setAccountData(playeracc, "player.clothes", getPedClothes(source, 0)) 
    end 
end 
  
local playeracc = getPlayerAccount(thePlayer) 
if acc then 
    for i=0,17 do 
        local texture, model = getPedClothes(thePlayer) 
        if texture and model then 
            setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) 
            setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) 
        end 
    end 
end 
  
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 
addEventHandler("onPlayerJoin", root, onPlayerJoinSaveClothes) 

Link to comment

That doesn't makes any sense.

function onPlayerQuitSaveClothes() 
local playeracc = getPlayerAccount(thePlayer) 
if acc then 
    for i=0,17 do 
        local texture, model = getPedClothes" class="kw2">getPedClothes(thePlayer) 
        if texture and model then 
            setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) 
            setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) 
           end 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 

Link to comment
function onPlayerQuitSaveClothes() 
local playeracc = getPlayerAccount(thePlayer) 
if playeracc then 
    for i=0,17 do 
        local texture, model = getPedClothes(thePlayer) 
        if texture and model then 
            setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) 
            setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) 
           end 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 

Link to comment

Offcourse it doesn't work, you need to script the loading part yourself...

THIS IS ONLY STORAGE:

function onPlayerQuitSaveClothes() 
    local thePlayer = source 
    local playeracc = getPlayerAccount(thePlayer) 
    if playeracc then 
        for i=0,17 do 
            local texture, model = getPedClothe(thePlayer) 
            if texture and model then 
                setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) 
                setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) 
            end 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 

Link to comment

Now i do somthing and now console say:

Warning : bad argument @ 'getPlayerAccount' (string-defined function)

Warning: bad argument @ 'addEventHandler* (string-defined function)

This is script :

local acc = getPlayerAccount(thePlayer) 
if acc then 
    for i=0,17 do 
        local texture, model = getPedClothes(thePlayer) 
        if texture and model then 
            setAccountData(acc, "clothes." .. tostring(i) .. ".texture", texture) 
            setAccountData(acc, "clothes." .. tostring(i) .. ".model", model) 
        end 
    end 
end 
addEventHandler("onPlayerJoin", root, onPlayerGetSaveClothes) 
  
function onPlayerQuitSaveClothes() 
    local thePlayer = source 
    local playeracc = getPlayerAccount(thePlayer) 
    if playeracc then 
        for i=0,17 do 
            local texture, model = getPedClothes(thePlayer) 
            if texture and model then 
                setAccountData(playeracc, "clothes." .. tostring(i) .. ".texture", texture) 
                setAccountData(playeracc, "clothes." .. tostring(i) .. ".model", model) 
            end 
        end 
    end 
end 
addEventHandler("onPlayerQuit", root, onPlayerQuitSaveClothes) 

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