Jump to content

script problem


abdalbaset

Recommended Posts

i made this script but whene i start its i can see the ped but its dont have and weps and its not shoting me

dubug [15:49:13] ERROR: peds\ped.lua:7: attempt to call global 'setPedControlState' (anil value)

lua

  
  
    addEventHandler ( "onResourceStart", getResourceRootElement(), 
function  ( ) 
    ped = createPed ( 191,2493.623,-1668.179,13.343,90) 
     setPedWeaponSlot (ped, 1 ) 
     setPedControlState ( ped,fire,true) 
     
     
end ) 

meta

  

Link to comment

server.lua

  
  
  
    addEventHandler ( "onResourceStart", getResourceRootElement(), 
function  ( ) 
    ped = createPed ( 191,2493.623,-1668.179,13.343,90) 
     setPedWeaponSlot (ped,) 
     triggerClientEvent("onPedControl",source) 
    
    
end ) 
  

client.lua

  
function triggered() 
setPedControlState ( ped,fire,true) 
end 
addEvent( "onPedControl", true ) 
addEventHandler( "onPedControl",source, triggered ) 
  

You can't use client and server mixed functions.

Link to comment

You had a few typos and a couple wrong arguments, try this one.

Server-side

addEventHandler( "onResourceStart", resourceRoot, 
    function( ) 
        local ped = createPed( 191, 2493.623, -1668.179, 13.343, 90 ) 
        setTimer( function( ped ) 
            if ( not isElement( ped ) ) then return end 
            giveWeapon( ped, 22, 9999, true ) 
            triggerClientEvent( root, "onPedControl", ped ) 
        end, 100, 1, ped ) 
    end 
) 

Client-side

addEvent( "onPedControl", true ) 
addEventHandler( "onPedControl", root, 
    function( ) 
        setPedControlState( source, "fire", true ) 
    end 
) 

Link to comment

   

Client side

  
 colsp1=createColSphere ( 2493.623, -1668.179, 13.343, 15 ) 
      
    addEvent( "onPedControl", true ) 
    addEventHandler( "onPedControl", root, 
        function( ) 
            setPedControlState( source, "fire", true ) 
        end 
    ) 
    
    
    function colh(player) 
    
    
  -------my problem that idk what to put here to make the ped  shooting the player who enter the colshap 
    
    end 
addEventHandler("onColShapeHit",colsp1,colh) 
  
  
  
  
  

Server side

 

  
  addEventHandler( "onResourceStart", resourceRoot, 
        function( ) 
            local ped = createPed( 191, 2493.623, -1668.179, 13.343, 90 ) 
            setTimer( function( ped ) 
                if ( not isElement( ped ) ) then return end 
                giveWeapon( ped, 27, 9999, true ) 
                triggerClientEvent( root, "onPedControl", ped ) 
                triggerClientEvent( root, "onColShapeHit", ped ) 
            end, 100, 1, ped ) 
        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...