Jump to content

problems


Nerses

Recommended Posts

Let ' em have it. Problem:

[2015-05-16 02:48:49] ERROR: [gameplay]/bpsmoke/server.lua:8: exports: Call to non-running server resource (bone_attach) [string "?"]

[2015-05-16 02:50:49] WARNING: [gameplay]/bpsmoke/server.lua:12: Bad argument @ 'destroyElement' [Expected element at argument 1]

here is the script itself

local cigarettes = { } 
local timer = 2*60000 
  
function cigarette(thePlayer) 
    if ( not isElement ( cigarettes [ thePlayer ] ) ) then   
      local x, y, z = getElementPosition ( thePlayer ) 
        cigarettes [ thePlayer ] = createObject ( 1485, 0, 0, 0 ) 
          exports [ "bone_attach" ]:attachElementToBone ( cigarettes [ thePlayer ], thePlayer,1, 0.07, 0.02, 0.07, 0, 50, 118 )  
         else 
             outputChatBox ( "Вы еще не докурили!", thePlayer,255,0,0 ) 
       end 
       setTimer(destroyElement,timer,1, cigarettes [ thePlayer ] ) 
end 
  
  
  
addEventHandler ( "onPlayerJoin", root, 
    function ( ) 
        bindKey ( source, ";", "down", cigarette  ) 
    end 
) 
  
addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        for _, player in ipairs ( getElementsByType ( "player" ) ) do 
            bindKey ( player, ";", "down", cigarette  ) 
        end 
    end 
) 
  
  

Link to comment

You need this ;Click Me!

About the warning this is how you can fix it

function cigarette(thePlayer) 
    if ( not isElement ( cigarettes [ thePlayer ] ) ) then   
      local x, y, z = getElementPosition ( thePlayer ) 
        cigarettes [ thePlayer ] = createObject ( 1485, 0, 0, 0 ) 
          exports [ "bone_attach" ]:attachElementToBone ( cigarettes [ thePlayer ], thePlayer,1, 0.07, 0.02, 0.07, 0, 50, 118 ) 
         else 
             outputChatBox ( "Вы еще не докурили!", thePlayer,255,0,0 ) 
       end 
        setTimer(function(player) 
            if isElement(cigarettes [player]) then  
                destroyElement(cigarettes [player]) 
            end 
        end,timer,1,thePlayer) 
end 

Link to comment
You need this ;Click Me!

About the warning this is how you can fix it

function cigarette(thePlayer) 
    if ( not isElement ( cigarettes [ thePlayer ] ) ) then   
      local x, y, z = getElementPosition ( thePlayer ) 
        cigarettes [ thePlayer ] = createObject ( 1485, 0, 0, 0 ) 
          exports [ "bone_attach" ]:attachElementToBone ( cigarettes [ thePlayer ], thePlayer,1, 0.07, 0.02, 0.07, 0, 50, 118 ) 
         else 
             outputChatBox ( "Вы еще не докурили!", thePlayer,255,0,0 ) 
       end 
        setTimer(function(player) 
            if isElement(cigarettes [player]) then  
                destroyElement(cigarettes [player]) 
            end 
        end,timer,1,thePlayer) 
end 

I don't know:(

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