Jump to content

problem at police


emad10

Recommended Posts

Police in this code have a problem

Means that not all the police fired bullets only one shooting

+

It shows to me also this error

[2012-11-24 06:27:11] WARNING: 43\server.lua:27: Bad 'element' pointer @ 'getElementType'(1) 

-- Server Side 
  
thePositions = { 
    { 1514.3770751953, -1677.8481445313, 14.046875 }, 
    { 1515.3770751953, -1677.8481445313, 14.046875 }, 
    { 1516.3770751953, -1677.8481445313, 14.046875 }, 
    { 1517.3770751953, -1677.8481445313, 14.046875 }, 
    { 1518.3770751953, -1677.8481445313, 14.046875 }, 
    { 1513.3770751953, -1678.8481445313, 14.046875 }, 
    { 1513.3770751953, -1679.8481445313, 14.046875 }, 
    { 1513.3770751953, -1680.8481445313, 14.046875 }, 
    { 1513.3770751953, -1681.8481445313, 14.046875 }, 
    { 1513.3770751953, -1682.8481445313, 14.046875 },    
} 
  
for _, AllPositions in ipairs ( thePositions ) do 
    createPed ( 124, AllPositions [1], AllPositions [2], AllPositions [3], AllPositions [4], AllPositions [5], AllPositions [6], AllPositions [7], AllPositions [8],AllPositions [9],AllPositions [10] ) 
end 
 theMarker = createMarker ( 0, 0, 0, "cylinder", 15, 0, 0, 0, 0 ) 
  
setPedStat ( Ped, 77, 999 ) 
setPedWeaponSlot ( Ped, 3 ) 
attachElements ( theMarker, Ped, 0, 0, -1 ) 
setTimer ( giveWeapon, 5000, 0, Ped, 25, 99999, true ) 
      
addEventHandler ( "onMarkerHit", getResourceRootElement ( getThisResource ( ) ), 
    function ( thePlayer ) 
        if getElementType ( thePlayer ) == "player" then 
            if getPlayerTeam ( thePlayer ) == getTeamFromName ( "Skulls" ) then         
                triggerClientEvent ( thePlayer, "setPedAttacking", thePlayer, thePed ) 
                if isPedInVehicle ( thePlayer ) then 
                    destroyElement ( getPedOccupiedVehicle ( thePlayer ) ) 
                end 
            end 
        end 
    end 
) 
      
addEventHandler ( "onMarkerLeave", getResourceRootElement ( getThisResource ( ) ), 
    function ( thePlayer ) 
        if getElementType ( thePlayer ) == "player" then 
            triggerClientEvent ( thePlayer, "setPedStanding", thePlayer, thePed ) 
            setTimer ( giveWeapon, 500, 1, thePed, 25, 99999, true ) 
        end 
    end 
) 
  
  

  
  
-- Client Side 
addEvent ( "setPedAttacking", true ) 
addEventHandler ( "setPedAttacking", root, 
    function ( thePed ) 
        setTimer ( 
            function ( ) 
                x, y, z = getElementPosition ( localPlayer ) 
                setPedAimTarget ( thePed, x, y, z ) 
            end 
        , 100, 0 ) 
        setPedControlState ( thePed, "fire", true ) 
        outputChatBox ( "* Start Shooting !!!", 255, 255, 0, true )     
    end 
) 
          
addEvent ( "setPedStanding", true ) 
addEventHandler ( "setPedStanding", root, 
    function ( thePed ) 
        setPedControlState ( thePed, "fire", false ) 
        outputChatBox ( "* Stop Shooting !!!", 255, 255, 0, true )      
        for _, xad in ipairs ( getTimers ( 100 ) ) do 
            killTimer ( xad ) 
        end     
    end 
) 

Link to comment
  • Other Languages Moderators
Police in this code have a problem

Means that not all the police fired bullets only one shooting

+

It shows to me also this error

[2012-11-24 06:27:11] WARNING: 43\server.lua:27: Bad 'element' pointer @ 'getElementType'(1) 

-- Server Side 
  
thePositions = { 
    { 1514.3770751953, -1677.8481445313, 14.046875 }, 
    { 1515.3770751953, -1677.8481445313, 14.046875 }, 
    { 1516.3770751953, -1677.8481445313, 14.046875 }, 
    { 1517.3770751953, -1677.8481445313, 14.046875 }, 
    { 1518.3770751953, -1677.8481445313, 14.046875 }, 
    { 1513.3770751953, -1678.8481445313, 14.046875 }, 
    { 1513.3770751953, -1679.8481445313, 14.046875 }, 
    { 1513.3770751953, -1680.8481445313, 14.046875 }, 
    { 1513.3770751953, -1681.8481445313, 14.046875 }, 
    { 1513.3770751953, -1682.8481445313, 14.046875 },    
} 
  
for _, AllPositions in ipairs ( thePositions ) do 
    createPed ( 124, AllPositions [1], AllPositions [2], AllPositions [3], AllPositions [4], AllPositions [5], AllPositions [6], AllPositions [7], AllPositions [8],AllPositions [9],AllPositions [10] ) 
end 
 theMarker = createMarker ( 0, 0, 0, "cylinder", 15, 0, 0, 0, 0 ) 
  
setPedStat ( Ped, 77, 999 ) 
setPedWeaponSlot ( Ped, 3 ) 
attachElements ( theMarker, Ped, 0, 0, -1 ) 
setTimer ( giveWeapon, 5000, 0, Ped, 25, 99999, true ) 
      
addEventHandler ( "onMarkerHit", getResourceRootElement ( getThisResource ( ) ), 
    function ( thePlayer ) 
        if getElementType ( thePlayer ) == "player" then 
            if getPlayerTeam ( thePlayer ) == getTeamFromName ( "Skulls" ) then         
                triggerClientEvent ( thePlayer, "setPedAttacking", thePlayer, thePed ) 
                if isPedInVehicle ( thePlayer ) then 
                    destroyElement ( getPedOccupiedVehicle ( thePlayer ) ) 
                end 
            end 
        end 
    end 
) 
      
addEventHandler ( "onMarkerLeave", getResourceRootElement ( getThisResource ( ) ), 
    function ( thePlayer ) 
        if getElementType ( thePlayer ) == "player" then 
            triggerClientEvent ( thePlayer, "setPedStanding", thePlayer, thePed ) 
            setTimer ( giveWeapon, 500, 1, thePed, 25, 99999, true ) 
        end 
    end 
) 
  
  

  
  
-- Client Side 
addEvent ( "setPedAttacking", true ) 
addEventHandler ( "setPedAttacking", root, 
    function ( thePed ) 
        setTimer ( 
            function ( ) 
                x, y, z = getElementPosition ( localPlayer ) 
                setPedAimTarget ( thePed, x, y, z ) 
            end 
        , 100, 0 ) 
        setPedControlState ( thePed, "fire", true ) 
        outputChatBox ( "* Start Shooting !!!", 255, 255, 0, true )     
    end 
) 
          
addEvent ( "setPedStanding", true ) 
addEventHandler ( "setPedStanding", root, 
    function ( thePed ) 
        setPedControlState ( thePed, "fire", false ) 
        outputChatBox ( "* Stop Shooting !!!", 255, 255, 0, true )      
        for _, xad in ipairs ( getTimers ( 100 ) ) do 
            killTimer ( xad ) 
        end     
    end 
) 

Variable 'thePed' is not defined in your code.

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