Citizen.CreateThread(function()
local networkId = nil
local hash = GetHashKey("a_f_y_carclub_01")
RegisterCommand("bodyguard", function()
while not HasModelLoaded(hash) do
RequestModel(hash)
Wait(20)
end
local playerPed = PlayerPedId()
local player = GetPlayerPed(playerPed)
local playerPosition = GetOffsetFromEntityInWorldCoords(playerPed, 0.0, 5.0, 0.0)
local playerGroup = GetPedGroupIndex(playerPed)
ped = CreatePed("PED_TYPE_SPECIAL", "a_f_y_carclub_01", playerPosition.x, playerPosition.y, playerPosition.z, 1, true, true)
SetPedCanSwitchWeapon(ped, false)
SetPedAsGroupMember(ped, playerGroup)
GiveWeaponToPed(ped, "weapon_pistol" , 999, true, true)
SetPedComponentVariation(ped, 0, 2, 2, 0)
SetPedComponentVariation(ped, 2, 1, 0, 0)
SetPedComponentVariation(ped, 3, 3, 0, 0)
SetPedComponentVariation(ped, 4, 0, 4, 0)
SetPedComponentVariation(ped, 6, 1, 0, 0)
SetPedComponentVariation(ped, 5, 3, 3, 0)
SetPedPropIndex(ped, 0, 1, 0, 0)
SetPedPropIndex(ped, 1, 0, 0, 0)
networkId = NetworkGetNetworkIdFromEntity(ped)
local ped = NetworkGetEntityFromNetworkId(networkId)
end)
end)
So im trying to make bodyguard ped but im new to this so how could i make it impossible to spawn more than 1 ped?