Jump to content

السلاح الذي مع اللاعب


Recommended Posts

function giveWeaponsOnSpawn ( theSpawnpont, theTeam ) 
    giveWeapon ( source, 31, 200 ) -- Gives the M4 weapon with 200 ammo 
end 
addEventHandler ( "onPlayerSpawn", getRootElement(), giveWeaponsOnSpawn ) -- attach the event handler 

function consoleGive ( thePlayer, commandName, weaponID, ammo ) 
    local status = giveWeapon ( thePlayer, weaponID, ammo, true )   -- attempt to give the weapon, forcing it as selected weapon 
    if ( not status ) then                                          -- if it was unsuccessful 
        outputConsole ( "Failed to give weapon.", thePlayer )   -- tell the player 
    end 
end 
addCommandHandler ( "give", consoleGive ) 

ped = createPed( 19, -1634.5775, 1203.85, 7.1796 ) 
  
addCommandHandler( "give", 
  function ( player, command, id, amount ) 
    if not tonumber ( id ) then return end 
  
    if not tonumber ( amount ) then 
        amount = 9001 
    end 
  
    giveWeapon( ped, id, amount, true ) 
  end 
) 

اتمنا افدتك

Link to comment
-- Find a player called someguy and find his current weapon id. 
local weaponType = getPedWeapon ( getRandomPlayer() ) 
-- If a weapon type was returned then 
if ( weaponType ) then 
    outputChatBox ( "someguy's current Weapon-type: " .. weaponType .. "." ) -- Display the weapon type in the chat box 
end 

Link to comment
-- Find a player called someguy and find his current weapon id. 
local weaponType = getPedWeapon ( getRandomPlayer() ) 
-- If a weapon type was returned then 
if ( weaponType ) then 
    outputChatBox ( "someguy's current Weapon-type: " .. weaponType .. "." ) -- Display the weapon type in the chat box 
end 

ذا مثال الويكي اظن انه لو يبي يتعلم للفكشن يروح الويكي او يسوي الوظيفة واذا كان في غلط يطرحها لنا .. :roll:

Link to comment
-- Find a player called someguy and find his current weapon id. 
local weaponType = getPedWeapon ( getRandomPlayer() ) 
-- If a weapon type was returned then 
if ( weaponType ) then 
    outputChatBox ( "someguy's current Weapon-type: " .. weaponType .. "." ) -- Display the weapon type in the chat box 
end 

ذا مثال الويكي اظن انه لو يبي يتعلم للفكشن يروح الويكي او يسوي الوظيفة واذا كان في غلط يطرحها لنا .. :roll:

عطيته مثال على هاذي :

getPedWeapon 

:roll:

Link to comment
addEventHandler( "onClientElementColShapeHit",CHT2, 
   function  ( ThePlayer ) 
if( getElementType( source ) == "vehicle" ) and ( isPedInVehicle ( ThePlayer ) )then 
setElementFrozen ( vehicle,true ); 
local weaponType = getPedWeapon (localPlayer )   
local weponid = getWeaponNameFromID ( 3 ) 
if ( weponid == 3 ) 
setElementFrozen ( vehicle,false ); 
end 
end 
end 
) 

Link to comment
addEventHandler( "onClientElementColShapeHit",CHT2, 
   function  ( ThePlayer ) 
if( getElementType( source ) == "vehicle" ) and ( isPedInVehicle ( ThePlayer ) )then 
setElementFrozen ( vehicle,true ); 
local weaponType = getPedWeapon (localPlayer )   
local weponid = getWeaponNameFromID ( 3 ) 
if ( weponid == 3 ) 
setElementFrozen ( vehicle,false ); 
end 
end 
end 
) 

getWeaponIDFromName 
Link to comment
addEventHandler( "onClientElementColShapeHit", CHT2, 
    function( element ) 
        if getElementType( element ) == "vehicle" then 
            local thePlayer = getVehicleOccupant( element, 0 ) 
            if not thePlayer then return end 
            setElementFrozen( element,true ) 
            local weaponType = getPedWeapon( thePlayer ) 
            local totalAmmo = getPedTotalAmmo( thePlayer ) 
            if weaponType == 3 and totalAmmo > 0 then 
                setElementFrozen( element, false ) 
            end 
        end 
    end 
) 

Link to comment
addEventHandler( "onClientElementColShapeHit", CHT2, 
    function( element ) 
        if getElementType( element ) == "vehicle" then 
            local thePlayer = getVehicleOccupant( element, 0 ) 
            if not thePlayer then return end 
            setElementFrozen( element,true ) 
            local weaponType = getPedWeapon( thePlayer ) 
            local totalAmmo = getPedTotalAmmo( thePlayer ) 
            if weaponType == 3 and totalAmmo > 0 then 
                setElementFrozen( element, false ) 
            end 
        end 
    end 
) 

theShape: the colshape that the element entered.

onClientElementColShapeHit

Link to comment

o.O

خخخ onClientColShapeHit حسبتها

addEventHandler( "onClientElementColShapeHit", CHT2, 
    function( ) 
        if getElementType( source ) == "vehicle" then 
            local thePlayer = getVehicleOccupant( source, 0 ) 
            if not thePlayer then return end 
            setElementFrozen( source,true ) 
            local weaponType = getPedWeapon( thePlayer ) 
            local totalAmmo = getPedTotalAmmo( thePlayer ) 
            if weaponType == 3 and totalAmmo > 0 then 
                setElementFrozen( source, false ) 
            end 
        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...