Jump to content

Проблема с воротами по скину(


Recommended Posts

Все привет,ребята помогите я уже два дня мудрю не как не могу понять в чем дело ворота появляются но по скину не открываются,пожалуйста помогите(

local gate = createObject(10841, 2595.5, -2140.3000488281,6.9000000953674 ) 
local gatecol = createColCircle ( 2595.5, -2140.3000488281, 25 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates(thePlayer) 
        if getElementModel ( thePlayer ) == 217 then --Will open only if the player is in the male staff skin 
        moveObject ( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674, 0, 0, 0 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        end 
end 
addEventHandler( "onColShapeHit", gatecol, openagates ) 
  
function closeagates(thePlayer) 
        if getElementModel( thePlayer ) == 217 then --Will close only if the player is in the male staff skin 
       moveObject (gate, 6000, 2595.5, -2140.3000488281,6.9000000953674) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
end 
addEventHandler( "onColShapeLeave", gatecol, closeagates ) 

Link to comment
Все привет,ребята помогите я уже два дня мудрю не как не могу понять в чем дело ворота появляются но по скину не открываются,пожалуйста помогите(

Что же у тебя не так? Посмотри где твой кулшейп и проверь ты действительно находишься в нем или может быть нет? Визуализируй его с помощью команды /showcol 1.

Link to comment

попробуй сделать на клиентской стороне

скорее всего у тебя игрок не определяется как thePlayer

что написано в debugscript ?

  
addEventHandler("onClientResourceStart", getRootElement(), 
function() 
setDevelopmentMode(true) 
end) 
  
local gate = createObject(10841, 2595.5, -2140.3000488281,6.9000000953674 ) 
local colshape = createColCircle ( 2595.5, -2140.3000488281, 25 ) 
  
function moveUp() 
  if ( getElementModel(localPlayer) == 217 ) then  
    moveObject( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674, 0, 0, 0 )  
  else 
  return false 
  end  
end  
addEventHandler("onClientColshapeHit", colshape, moveUp) 
  
function moveBack() 
  if ( getElementModel( localPlayer ) == 217 ) then  
    moveObject(  moveObject (gate, 6000, 2595.5, -2140.3000488281,6.9000000953674) 
  else 
  return false 
  end  
end  
addEventHandler("onClientColShapeLeave", colshape, moveBack) 
  

Link to comment
попробуй сделать на клиентской стороне

скорее всего у тебя игрок не определяется как thePlayer

что написано в debugscript ?

  
addEventHandler("onClientResourceStart", getRootElement(), 
function() 
setDevelopmentMode(true) 
end) 
  
local gate = createObject(10841, 2595.5, -2140.3000488281,6.9000000953674 ) 
local colshape = createColCircle ( 2595.5, -2140.3000488281, 25 ) 
  
function moveUp() 
  if ( getElementModel(localPlayer) == 217 ) then  
    moveObject( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674, 0, 0, 0 )  
  else 
  return false 
  end  
end  
addEventHandler("onClientColshapeHit", colshape, moveUp) 
  
function moveBack() 
  if ( getElementModel( localPlayer ) == 217 ) then  
    moveObject(  moveObject (gate, 6000, 2595.5, -2140.3000488281,6.9000000953674) 
  else 
  return false 
  end  
end  
addEventHandler("onClientColShapeLeave", colshape, moveBack) 
  

И что из этого выйдет на клиенте ? Открытие ворот только у данного игрока ?

А еще у тебя во второй функции плохой копипаст.

В коде ТС вроде бы всё нормально, с thePlayer уж точно.

Может быть не работает из-за плохой загрузки ресурса.

Link to comment

Я один оказался самым глазастым ^_^

local gate = createObject(10841, 2595.5, -2140.3000488281,6.9000000953674 ) 
local gatecol = createColCircle ( 2595.5, -2140.3000488281, 25 ) --Co-Ordinates "X" and "Y" and the radius, I use 15 as default. 
  
function openagates(thePlayer) 
        if getElementModel ( thePlayer ) == 217 then --Will open only if the player is in the male staff skin 
        moveObject ( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674 ) --The speed in which 7000 is slow and 2000 is fast to open, Co-Ordinates for the gate to move to. 
        end 
end 
addEventHandler( "onColShapeHit", gatecol, openagates ) 
  
function closeagates(thePlayer) 
        if getElementModel( thePlayer ) == 217 then --Will close only if the player is in the male staff skin 
       moveObject (gate, 6000, 2595.5, -2140.3000488281,6.9000000953674) --The speed in which 7000 is slow and 1000 is fast to open, Co-Ordinates for the gate to close. 
        end 
end 
addEventHandler( "onColShapeLeave", gatecol, closeagates ) 

Вот рабочий код =)

Но в чем ошибка спросите вы?

А я вам отвечу!

moveObject ( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674, 0, 0, 0 ) 

в данной строке!

После удаления последних трех аргументов которые отвечают за разворот я добился работоспособности скрипта без ошибок)

Таким образом строчка должна выглядеть так

moveObject ( gate, 6000, 2618.3000488281, -2140.3000488281, 6.9000000953674) 

ЗЫ Ко всему прочему в коде одинаковые позиции как при вхождении в колшейп так и при выходе, тоесть ворота некуда не уедут потому что им не сказали куда смещаться!

Link to comment
Я один оказался самым глазастым ^_^

После удаления последних трех аргументов которые отвечают за разворот я добился работоспособности скрипта без ошибок)

В ТС, вроде бы, проблема с колшейпом была...

Link to comment
  • 3 weeks later...

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