function createFactionVehicle ( model, x, y, z, rx, ry, rz, faction, c1, c2, c3, c4, numberplate )
outputDebugString ( type ( faction ) )
outputDebugString ( faction )
if not c3 then
c3 = 0
end
if not c4 then
c4 = 0
end
if not numberplate then
numberplate = fraktionNames[faction]
end
local veh = createVehicle ( model, x, y, z, rx, ry, rz, numberplate )
setVehicleColor ( veh, c1, c2, c3, c4 )
setVehiclePaintjob ( veh, 3 )
toggleVehicleRespawn ( veh, true )
setVehicleRespawnDelay ( veh, FCarDestroyRespawn * 1000 * 60 )
setVehicleIdleRespawnDelay ( veh, FCarIdleRespawn * 1000 * 60 )
factionVehicles[faction][veh] = true
vioSetElementData ( veh, "owner", fraktionNames[faction] )
vioSetElementData ( veh, "ownerfraktion", faction )
if faction == 1 then
addEventHandler ( "onVehicleEnter", veh,
function ( player, seat )
local veh = source
if getPedOccupiedVehicleSeat ( player ) == 0 then
if not isOnDuty( player ) then
opticExitVehicle ( player )
infobox ( player, "Du bist kein\n"..fraktionNames[faction].."!", 5000, 125, 0, 0 )
else
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) then
bindKey ( player, "sub_mission", "down", policeComputer )
end
end
else
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) and isOnDuty( player ) then
bindKey ( player, "sub_mission", "down", policeComputer )
end
end
end )
elseif faction == 6 then
addEventHandler ( "onVehicleEnter", veh,
function ( player, seat )
local veh = source
if getPedOccupiedVehicleSeat ( player ) == 0 then
if isFBI ( player ) and isOnDuty( player ) then
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) then
bindKey ( player, "sub_mission", "down", policeComputer )
end
else
opticExitVehicle ( player )
infobox ( player, "Du bist kein\n"..fraktionNames[faction].."!", 5000, 125, 0, 0 )
end
else
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) and isOnDuty( player ) then
bindKey ( player, "sub_mission", "down", policeComputer )
end
end
end )
elseif faction == 8 then
addEventHandler ( "onVehicleEnter", veh,
function ( player, seat )
local veh = source
if getPedOccupiedVehicleSeat ( player ) == 0 then
if not isArmy(player) then
opticExitVehicle ( player )
infobox ( player, "Du bist kein\n"..fraktionNames[faction].."!", 5000, 125, 0, 0 )
else
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) and getElementModel ( veh ) ~= 520 then
bindKey ( player, "sub_mission", "down", policeComputer )
end
if getElementModel ( veh ) == 433 then
setElementHealth ( player, 100 )
triggerClientEvent ( player, "sec_health_give", getRootElement(), 999 )
setPedArmor ( player, 100 )
triggerClientEvent ( player, "sec_armor_give", getRootElement(), 100 )
triggerClientEvent ( player, "eatSomething", getRootElement() )
elseif getElementModel ( veh ) == 432 then
if vioGetElementData ( player, "job" ) ~= "tankcommander" then
opticExitVehicle ( player )
outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
end
elseif getElementModel ( veh ) == 425 or getElementModel ( veh ) == 520 then
if vioGetElementData ( player, "job" ) ~= "air" then
opticExitVehicle ( player )
outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
end
elseif getElementModel ( veh ) == 563 or getElementModel ( veh ) == 595 then
if vioGetElementData ( player, "job" ) ~= "marine" and seat == 0 then
opticExitVehicle ( player )
outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
else
giveWeapon ( player, 46, 3, true )
triggerClientEvent ( player, "sec_gun_give", getRootElement(), 46, 3 )
end
end
end
else
if not isKeyBound ( player, "sub_mission", "down", policeComputer ) and isOnDuty( player ) then
bindKey ( player, "sub_mission", "down", policeComputer )
end
if getElementModel ( veh ) == 433 then
setElementHealth ( player, 100 )
triggerClientEvent ( player, "sec_health_give", getRootElement(), 999 )
setPedArmor ( player, 100 )
triggerClientEvent ( player, "sec_armor_give", getRootElement(), 100 )
triggerClientEvent ( player, "eatSomething", getRootElement() )
end
end
end )
else
addEventHandler ( "onVehicleEnter", veh,
function ( player, seat )
local veh = source
if getPedOccupiedVehicleSeat ( player ) == 0 then
if vioGetElementData ( player, "fraktion" ) ~= faction then
opticExitVehicle ( player )
infobox ( player, "Du bist kein\n"..fraktionNames[faction].."!", 5000, 125, 0, 0 )
end
end
end )
end
return veh
end
Alles anzeigen