Jump to content

[HELP] ExitMarker doesn't work


ViRuZGamiing

Recommended Posts

Hi,

My entranceMarker works but exit doesn't;

    exitMarker = createMarker(-30.9,-91.6, 1002.5, 'cylinder', 1.0, 0, 100, 255, 255) 
    setElementInterior (exitMarker, 18) 
    entranceMarker = createMarker(-2442.6001, 754.70001, 34.1, 'cylinder', 2.0, 0, 100, 255, 255) 
  
function enterHit( thePlayer, matchingDimension ) 
    local elementType = getElementType( thePlayer ) 
    if (elementType) then 
    setElementInterior (thePlayer, 18) 
    setElementPosition (thePlayer, -31, -90.2, 1003.5) 
    end 
end 
  
function exitHit ( thePlayer, matchingDimension ) 
    local elementType = getElementType( thePlayer ) 
    if (elementType) then 
    setElementInterior (thePlayer, 0) 
    setElementPosition (thePlayer, -2442.3999, 751.59998, 35.2) 
    end 
end 
  
addEventHandler( "onMarkerHit", exitMarker, exitHit ) 
addEventHandler( "onMarkerHit", entranceMarker, enterHit ) 

Link to comment

Thx works,

Now i'm trying to use some Pedistrian functions.

I want to do that when a player aims at pedistrian test, ped test gets a weapon and shoots at the player.

This is what I got;

--server 
function testAttack () 
target = getPedTarget ( testKeeper ) 
    if ( target ) then 
    giveWeapon (testPed, 31, 100) 
    triggerClientEvent (thePlayer, "testShoot", root) 
    end 
end 
  
addEventHandler ( "onPlayerDamage", root, testAttack ) 
  
--client 
function testShoot () 
    setPedControlState(testPed, fire, true) 
end 
  
addEvent( "testShoot", true ) 
addEventHandler( "testShoot", root, testShoot) 

Link to comment

Try this (Not tested).

--server 
  
testPed = createPed(skin, x, y, z) 
  
function testAttack(target) 
    if getElementType(target) == "ped" and target == testPed then 
        giveWeapon(target, 31, 100) 
        triggerClientEvent(root, "testShoot", source, target) 
    end 
end 
addEventHandler("onPlayerTarget", root, testAttack) 
  
--client 
function testShoot(target) 
    local x, y, z = getElementPosition(source) 
    setPedAimTarget(target, x, y, z) 
    setPedControlState(target, "fire", true) 
end 
addEvent("testShoot", true) 
addEventHandler("testShoot", root, testShoot) 

Link to comment

Change this:

if getElementType(target) == "ped" and target == testPed then 

To:

if target and getElementType(target) == "ped" and target == testPed then 

And Change this:

giveWeapon(target, 31, 100) 

To:

giveWeapon(target, 31, 100, true) 

Link to comment

@TA-PL I have this

function testPed() 
..... 
if ( isPedDead ( shopKeeper ) ) then 
    triggerClientEvent (source, "testMessage1", root) 
    testMarker = createMarker(-27,-91.6, 1002.5, 'cylinder', 1.5, 0, 100, 255, 255) 
    setElementInterior (robMarker, 18) 
end 
end 
  
function testHit ( thePlayer, matchingDimension ) 
    local elementType = getElementType( thePlayer ) 
        if (elementType) then 
        triggerClientEvent (source, "testMessage2", root) 
        end 
end 
  
addEventHandler( "onMarkerHit", testMarker, testHit ) 

I want to get testMarker out of testPed and trigger testHit but it doesn't work...

The event handler doesn't see testMarker

Link to comment
function testPed() 
..... 
if ( isPedDead ( shopKeeper ) ) then 
    triggerClientEvent (source, "testMessage1", root) 
    testMarker = createMarker(-27,-91.6, 1002.5, 'cylinder', 1.5, 0, 100, 255, 255) 
    addEventHandler( "onMarkerHit", testMarker, testHit ) 
    setElementInterior (robMarker, 18) 
end 
end 
  
function testHit ( thePlayer, matchingDimension ) 
    local elementType = getElementType( thePlayer ) 
        if (elementType) then 
        triggerClientEvent (source, "testMessage2", root) 
        end 
end 

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