اتمنى عدم السخرية
كلنت
function showAmmo(thePlayer, command, who )
local targetPlayer = getPlayerFromName ( who )
if ( thePlayer ) then
local ammo = getPedAmmoInClip ( targetPlayer )
outputChatBox ( who .. " has " .. ammo .. " ammo in his active clip" )
else
outputChatBox ( "Player '" .. who .. "' not found." )
end
end
addCommandHandler( "ammo", showAmmo )
myPlayer = getPlayerFromName ( "Someguy" )
-- If a player called 'Someguy' was found then
if ( myPlayer ) then
-- Retrieve the total amount of ammo for that player, and store it in a variable called 'ammo'
ammo = getPedTotalAmmo ( myPlayer )
-- Tell all the players how much ammo 'Someguy' has
outputChatBox ( "Someguy's current total ammo: " .. ammo .. "." )
end
سيرفر
addEventHandler ( "onPickupUse", money, pickupUse )
function createDeathPickup ( totalammo, killer, killerweapon, bodypart ) --when a player dies
x, y, z = getElementPosition ( source ) --get the position of the person who died and define it as x, y and z
currentweapon = getPlayerWeapon ( source ) --get the current weapon of the dead person
createPickup ( x, y, z, 2, currentweapon, 10000, totalammo )
end
addEventHandler ( "onPlayerWasted", getRootElement(), createDeathPickup ) --add an event handler for onPlayerWasted