Jump to content

Bad argument @'getVehicleOccupant' 'getPedOccupiedVehicle'


saluta

Recommended Posts

Spoiler

speedometer

 

addEvent( "removeMe", true ) 
addEventHandler( "removeMe", getRootElement(), function(player) 
    removePedFromVehicle( player ) 
    setPedAnimation( player, "dildo", "dildo_hit_3",-1,false,false,true,true)
    setTimer(function() setPedAnimation(player,true) end, 5*1000, 1)
end)

function onVehicleStartExit ( thePlayer, seat, jacked )
    local veh = getPedOccupiedVehicle(thePlayer)
    if veh then
        if getPedOccupiedVehicle (thePlayer) then
            if getElementData(thePlayer, "remeshok") == "strapped on" then
                outputChatBox("#FF0000RU: Отстегните ремень безопасности!",thePlayer,255,255,255,true)
                outputChatBox("#FF0000EN: Unfasten your seat belt!",thePlayer,255,255,255,true)
                cancelEvent()
            end
        end
    end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), onVehicleStartExit)

Spoiler

povorotnik

 

local dxShader = dxCreateShader("shader.fx")
local sh = {}

trigger = function(shader, type, veh)
  if sh[veh] then
    sh[veh] = nil
    return engineRemoveShaderFromWorldTexture(shader, type, veh)
  else
    sh[veh] = true
    return engineApplyShaderToWorldTexture(shader, type, veh)
  end
end
trigger2 = function(shader, veh)
  if sh[veh] then
    sh[veh] = nil
    engineRemoveShaderFromWorldTexture(shader, "rightflash", veh)
    return engineRemoveShaderFromWorldTexture(shader, "leftflash", veh)
  else
    sh[veh] = true
    engineApplyShaderToWorldTexture(shader, "rightflash", veh)
    return engineApplyShaderToWorldTexture(shader, "leftflash", veh)
  end
end

setTimer(function()
  for _,v in ipairs(getElementsByType("vehicle")) do
    if getElementData(v, "rightflash") then
      setElementData(v, 'leftflash', false)
      setElementData(v, 'allflash', false)
      trigger(dxShader, "rightflash", v)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,veh in ipairs(getElementsByType("vehicle")) do
    if getElementData(veh, "leftflash") then
      setElementData(veh, 'rightflash', false)
      setElementData(veh, 'allflash', false)
      trigger(dxShader, "leftflash", veh)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,vehicle in ipairs(getElementsByType("vehicle")) do
    if getElementData(vehicle, "allflash") then
        setElementData(vehicle, "leftflash", false)
        setElementData(vehicle, "rightflash", false)
          trigger2(dxShader, vehicle)
    end
  end
end
, 450, 0)

left = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if setElementData(veh, "leftflash", true) then
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
    setElementData(veh, "leftflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "leftflash", veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("[", "down", left)

right = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if setElementData(veh, "rightflash", true) then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
  else
    setElementData(veh, "rightflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("]", "down", right)
all = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if not getElementData(veh, "allflash") then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", true)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
      setElementData(veh, "allflash", false)
      engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
      engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
  end
end
bindKey("o", "down", all)

Spoiler

spacer.png

My previous topic was blocked just like that, there was nothing, even comments and advertisements that could violate the forum rule. Please help fix the warnings

Link to comment

First of all, use code blocks (preferably with Lua highlighting) instead of spoiler blocks. It's hard to read it the way it is.

Second, did you try to understand why those messages are there? Did you try doing things like checking the variable values, like this:

outputDebugString("veh = "..tostring(veh))

Documentation of both getVehicleOccupant and getPedOccupiedVehicle tells what return values are possible. If you check the variable values when the warnings appear and read the documentation on when those values are returned, it should be easy to understand why it happens.

Perhaps your topics were locked because of lack of research on your part (or at least it looked like that), so I'm trying to lead you on the right track.

Link to comment
Spoiler
local dxShader = dxCreateShader("shader.fx")
local sh = {}

trigger = function(shader, type, veh)
  if sh[veh] then
    sh[veh] = nil
    return engineRemoveShaderFromWorldTexture(shader, type, veh)
  else
    sh[veh] = true
    return engineApplyShaderToWorldTexture(shader, type, veh)
  end
end
trigger2 = function(shader, veh)
  if sh[veh] then
    sh[veh] = nil
    engineRemoveShaderFromWorldTexture(shader, "rightflash", veh)
    return engineRemoveShaderFromWorldTexture(shader, "leftflash", veh)
  else
    sh[veh] = true
    engineApplyShaderToWorldTexture(shader, "rightflash", veh)
    return engineApplyShaderToWorldTexture(shader, "leftflash", veh)
  end
end

setTimer(function()
  for _,v in ipairs(getElementsByType("vehicle")) do
    if getElementData(v, "rightflash") then
      setElementData(v, 'leftflash', false)
      setElementData(v, 'allflash', false)
      trigger(dxShader, "rightflash", v)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,veh in ipairs(getElementsByType("vehicle")) do
    if getElementData(veh, "leftflash") then
      setElementData(veh, 'rightflash', false)
      setElementData(veh, 'allflash', false)
      trigger(dxShader, "leftflash", veh)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,vehicle in ipairs(getElementsByType("vehicle")) do
    if getElementData(vehicle, "allflash") then
        setElementData(vehicle, "leftflash", false)
        setElementData(vehicle, "rightflash", false)
          trigger2(dxShader, vehicle)
    end
  end
end
, 450, 0)

left = function()
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleOccupant (veh) ~= localPlayer then return end
  if setElementData(veh, "leftflash", true) then
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
    setElementData(veh, "leftflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "leftflash", veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("[", "down", left)

right = function()
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleOccupant (veh) ~= localPlayer then return end
  if setElementData(veh, "rightflash", true) then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
  else
    setElementData(veh, "rightflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("]", "down", right)
all = function()
local veh = getPedOccupiedVehicle(localPlayer)
if not veh then return end
if getVehicleOccupant (veh) ~= localPlayer then return end
  if not getElementData(veh, "allflash") then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", true)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
      setElementData(veh, "allflash", false)
      engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
      engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
  end
end
bindKey("o", "down", all)

 

&
 

Spoiler
addEvent( "removeMe", true ) 
addEventHandler( "removeMe", getRootElement(), function(player) 
    removePedFromVehicle( player ) 
    setPedAnimation( player, "dildo", "dildo_hit_3",-1,false,false,true,true)
    setTimer(function() setPedAnimation(player,true) end, 5*1000, 1)
end)

function onVehicleStartExit ( thePlayer, seat, jacked )
    if getElementData(thePlayer, "remeshok") == "strapped on" then
        outputChatBox("#FF0000RU: Отстегните ремень безопасности!",thePlayer,255,255,255,true)
        outputChatBox("#FF0000EN: Unfasten your seat belt!",thePlayer,255,255,255,true)
        cancelEvent()
    end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), onVehicleStartExit)

 

 

  • Thanks 1
Link to comment
  • Moderators
4 hours ago, saluta said:

My previous topic was blocked just like that, there was nothing

There was literally nothing? No need to play the fool.

To be precise, your previous topic's were locked for the following reason:

Quote

The Scripting section is not meant for those unwilling to learn, whose only intent is to try get others to finish the scripts they need, line by line. We see this happening way too often -  someone with seemingly zero scripting skills does not react on-topic to the set of functions they can use that other users provide them, and does not seem to take any pushes in the right direction forward; they are just waiting for a collective effort from other scripters to develop what they want. This is what we do not want to see. 

 

Since people already replied to this topic, I will wait an amount of time before I may or may not come to the conclusion that you are doing the following:

Quote

The Scripting section is not meant for those unwilling to learn, whose only intent is to try get others to finish the scripts they need, line by line.

 

  • Like 1
Link to comment
15 hours ago, saluta said:
  Reveal hidden contents

speedometer

 

addEvent( "removeMe", true ) 
addEventHandler( "removeMe", getRootElement(), function(player) 
    removePedFromVehicle( player ) 
    setPedAnimation( player, "dildo", "dildo_hit_3",-1,false,false,true,true)
    setTimer(function() setPedAnimation(player,true) end, 5*1000, 1)
end)

function onVehicleStartExit ( thePlayer, seat, jacked )
    local veh = getPedOccupiedVehicle(thePlayer)
    if veh then
        if getPedOccupiedVehicle (thePlayer) then
            if getElementData(thePlayer, "remeshok") == "strapped on" then
                outputChatBox("#FF0000RU: Отстегните ремень безопасности!",thePlayer,255,255,255,true)
                outputChatBox("#FF0000EN: Unfasten your seat belt!",thePlayer,255,255,255,true)
                cancelEvent()
            end
        end
    end
end
addEventHandler ( "onVehicleStartExit", getRootElement(), onVehicleStartExit)

  Reveal hidden contents

povorotnik

 

local dxShader = dxCreateShader("shader.fx")
local sh = {}

trigger = function(shader, type, veh)
  if sh[veh] then
    sh[veh] = nil
    return engineRemoveShaderFromWorldTexture(shader, type, veh)
  else
    sh[veh] = true
    return engineApplyShaderToWorldTexture(shader, type, veh)
  end
end
trigger2 = function(shader, veh)
  if sh[veh] then
    sh[veh] = nil
    engineRemoveShaderFromWorldTexture(shader, "rightflash", veh)
    return engineRemoveShaderFromWorldTexture(shader, "leftflash", veh)
  else
    sh[veh] = true
    engineApplyShaderToWorldTexture(shader, "rightflash", veh)
    return engineApplyShaderToWorldTexture(shader, "leftflash", veh)
  end
end

setTimer(function()
  for _,v in ipairs(getElementsByType("vehicle")) do
    if getElementData(v, "rightflash") then
      setElementData(v, 'leftflash', false)
      setElementData(v, 'allflash', false)
      trigger(dxShader, "rightflash", v)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,veh in ipairs(getElementsByType("vehicle")) do
    if getElementData(veh, "leftflash") then
      setElementData(veh, 'rightflash', false)
      setElementData(veh, 'allflash', false)
      trigger(dxShader, "leftflash", veh)
    end
  end
end
, 450, 0)
setTimer(function()
  for _,vehicle in ipairs(getElementsByType("vehicle")) do
    if getElementData(vehicle, "allflash") then
        setElementData(vehicle, "leftflash", false)
        setElementData(vehicle, "rightflash", false)
          trigger2(dxShader, vehicle)
    end
  end
end
, 450, 0)

left = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if setElementData(veh, "leftflash", true) then
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
    setElementData(veh, "leftflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "leftflash", veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("[", "down", left)

right = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if setElementData(veh, "rightflash", true) then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    setElementData(veh, "allflash", false)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
  else
    setElementData(veh, "rightflash", false)
    engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    setTimer(function()
      end, 600, 0)
  end
end
bindKey("]", "down", right)
all = function()
local veh = getPedOccupiedVehicle(localPlayer)
if getVehicleOccupant (veh) ~= localPlayer then return end
if not veh then return end
  if not getElementData(veh, "allflash") then
      if getElementData(veh, 'leftflash') then
        setElementData(veh, "leftflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
    end
    if getElementData(veh, 'rightflash') then
        setElementData(veh, "rightflash", false)
        engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
    end
    setElementData(veh, "allflash", true)
    engineApplyShaderToWorldTexture(dxShader, "rightflash", veh)
    engineApplyShaderToWorldTexture(dxShader, "leftflash", veh)
  else
      setElementData(veh, "allflash", false)
      engineRemoveShaderFromWorldTexture(dxShader, "rightflash",veh)
      engineRemoveShaderFromWorldTexture(dxShader, "leftflash",veh)
  end
end
bindKey("o", "down", all)

  Hide contents

spacer.png

My previous topic was blocked just like that, there was nothing, even comments and advertisements that could violate the forum rule. Please help fix the warnings

You don't even tell us what are you trying to do. Just post a code and waiting for someone to fix it. ?

Link to comment
7 hours ago, Hydra said:

Вы даже не говорите нам, что пытаетесь сделать. Просто отправьте код и ждите, пока кто-нибудь его исправит. ?

and what is the forum about then?  or lazy?

Link to comment
1 minute ago, saluta said:

and what is the forum about then?  or lazy?

The forum is to ask your problems and us to tell you how you can solve them lmao
If you think someone will make the script for you then have fun waiting.

Link to comment
19 minutes ago, Hydra said:

Форум задает ваши проблемы, а мы расскажем, как вы можете их решить. Lmao
Если вы думаете, что кто-то напишет сценарий для вас, ждите с удовольствием.

What are you talking about or what?

Link to comment

Becaue the author of this topic is russian and translating this topic into russian let me answer in russian. Ask me if anybody need the translate.

 

22 hours ago, saluta said:

What are you talking about or what?

 

Дайте пожалуйста код в более нормальном виде, а не тексте. Опишите что вы хотите чтобы скрипт делал и когда именно возникает ошибка.

Link to comment
3 hours ago, Erlkonig said:

Becaue the author of this topic is russian and translating this topic into russian let me answer in russian. Ask me if anybody need the translate.

 

 

Дайте пожалуйста код в более нормальном виде, а не тексте. Опишите что вы хотите чтобы скрипт делал и когда именно возникает ошибка.

с чего ты взял что я руский? где я говорил что я руский, я не славянин, я римлянин раз ты хочешь узнать какой я нации и народа. И я Молдованин.

Problem solved

 

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