Problem bei : Bloods-Fraktion einfügen

  • Ultimate
  • Neu

    LUA-Quellcode

    1. fraktionNames = {}
    2. fraktionNames = { [0] = "Zivilisten", [1]="Polizei", [2]="Mafia", [3]="Triaden", [4]="Terroristen", [5]="Reporter", [6]="FBI", [7]="Los Aztecas", [8]="Bundeswehr", [9]="Angels of Death", [10]="Medic", [11]="O-AMT", [12]="Ballas", [13]="Grove", [14]="Bloods" }
    3. local allowToChangeSkin = false
    4. local allowToChangeSkinTimer = nil
    5. fraktionMembers = {}
    6. fraktionMemberList = {}
    7. fraktionMemberListInvite = {}
    8. for i = 0, #fraktionNames+1 do
    9. fraktionMembers[i] = {}
    10. fraktionMemberList[i] = {}
    11. fraktionMemberListInvite[i] = {}
    12. end
    13. local frespawnTimer = {}
    14. local zaehlerFrespawnTimer = {}
    15. factionVehicles = {}
    16. factionVehicles[1] = {}
    17. factionVehicles[2] = {}
    18. factionVehicles[3] = {}
    19. factionVehicles[4] = {}
    20. factionVehicles[5] = {}
    21. factionVehicles[6] = {}
    22. factionVehicles[7] = {}
    23. factionVehicles[8] = {}
    24. factionVehicles[9] = {}
    25. factionVehicles[10] = {}
    26. factionVehicles[11] = {}
    27. factionVehicles[12] = {}
    28. factionVehicles[13] = {}
    29. factionVehicles[14] = {}
    30. factionSkins = {}
    31. factionSkins[1] = { 280, 281, 282, 283, 284, 285, 288, 265, 266, 267 }
    32. factionSkins[2] = { 111, 112, 113, 124, 125, 126, 127, 237, 272 }
    33. factionSkins[3] = { 49, 117, 118, 120, 122, 123, 141, 169, 186, 294 }
    34. factionSkins[4] = { 221, 222, 220, 143, 142, 307 }
    35. factionSkins[5] = { 59, 141, 187, 188, 189, 296 }
    36. factionSkins[6] = { 285, 286, 165, 164, 163, 295 }
    37. factionSkins[7] = { 173, 174, 175, 115, 114, 116, 293, 292, 108, 109, 110 }
    38. factionSkins[8] = { 287, 312, 191 }
    39. factionSkins[9] = { 100, 247, 248, 298, 181, 299, 291 }
    40. factionSkins[10] = { 274, 275, 276, 70 }
    41. factionSkins[11] = { 305, 268, 201, 128, 50, 42 }
    42. factionSkins[12] = { 102, 103, 104, 195, 13 }
    43. factionSkins[13] = { 269, 270, 271, 301, 311, 105, 106, 107 }
    44. factionSkins[14] = { 19, 144, 297, 307, 303, 21, 233, 93, 40, 2, 12, 217, 223, 239 }
    45. aktionlaeuft = false
    46. ---------------------------------------------------------------------------------------------------------------
    47. function isPDCar ( car )
    48. if factionVehicles[1][car] then return true else return false end
    49. end
    50. function isMafiaCar ( car )
    51. if factionVehicles[2][car] then return true else return false end
    52. end
    53. function isTriadenCar ( car )
    54. if factionVehicles[3][car] then return true else return false end
    55. end
    56. function isTerrorCar ( car )
    57. if factionVehicles[4][car] then return true else return false end
    58. end
    59. function isNewsCar ( car )
    60. if factionVehicles[5][car] then return true else return false end
    61. end
    62. function isFBICar ( car )
    63. if factionVehicles[6][car] then return true else return false end
    64. end
    65. function isAztecasCar ( car )
    66. if factionVehicles[7][car] then return true else return false end
    67. end
    68. function isArmyCar ( car )
    69. if factionVehicles[8][car] then return true else return false end
    70. end
    71. function isBikerCar ( car )
    72. if factionVehicles[9][car] then return true else return false end
    73. end
    74. function isMedicCar ( car )
    75. if factionVehicles[10][car] then return true else return false end
    76. end
    77. function isMechanikerCar ( car )
    78. if factionVehicles[11][car] then return true else return false end
    79. end
    80. function isBallasCar ( car )
    81. if factionVehicles[12][car] then return true else return false end
    82. end
    83. function isGroveCar ( car )
    84. if factionVehicles[13][car] then return true else return false end
    85. end
    86. function isBloodsCar ( car )
    87. if factionVehicles[14][car] then return true else return false end
    88. end
    89. function isFederalCar ( car )
    90. if isArmyCar( car ) or isFBICar( car ) or isPDCar ( car ) then
    91. return true
    92. else
    93. return false
    94. end
    95. end
    96. function isEvilCar ( car )
    97. if isMafiaCar( car ) or isTriadenCar( car ) or isTerrorCar ( car ) or isAztecasCar ( car ) or isBikerCar ( car ) or isBallasCar ( car ) or isGroveCar ( car ) or isBloodsCar ( car ) then
    98. return true
    99. else
    100. return false
    101. end
    102. end
    103. function getPlayerFaction ( player )
    104. local fac = vioGetElementData ( player, "fraktion" )
    105. if fac then
    106. return tonumber(fac)
    107. else
    108. return false
    109. end
    110. end
    111. function getPlayerRank ( player )
    112. local ran = vioGetElementData ( player, "rang" )
    113. if ran then
    114. return tonumber(ran)
    115. else
    116. return false
    117. end
    118. end
    119. function getPlayerRankName ( player )
    120. local ran = getPlayerRank ( player )
    121. local fac = getPlayerFaction ( player )
    122. if ran then
    123. return factionRankNames[fac][ran]
    124. else
    125. return false
    126. end
    127. end
    128. -----------------------------------------------------------------------------------------------------
    129. function isReporter(player)
    130. if tonumber(vioGetElementData ( player, "fraktion" )) == 5 then return true else return false end
    131. end
    132. function isTerror(player)
    133. if tonumber(vioGetElementData ( player, "fraktion" )) == 4 then return true else return false end
    134. end
    135. function isTriad(player)
    136. if tonumber(vioGetElementData ( player, "fraktion" )) == 3 then return true else return false end
    137. end
    138. function isMafia(player)
    139. if tonumber(vioGetElementData ( player, "fraktion" )) == 2 then return true else return false end
    140. end
    141. function isCop(player)
    142. if tonumber(vioGetElementData ( player, "fraktion" )) == 1 then return true else return false end
    143. end
    144. function isFBI(player)
    145. if tonumber(vioGetElementData ( player, "fraktion" )) == 6 then return true else return false end
    146. end
    147. function isAztecas(player)
    148. if tonumber(vioGetElementData ( player, "fraktion" )) == 7 then return true else return false end
    149. end
    150. function isArmy(player)
    151. if tonumber(vioGetElementData ( player, "fraktion" )) == 8 then return true else return false end
    152. end
    153. function isBiker(player)
    154. if tonumber(vioGetElementData ( player, "fraktion" )) == 9 then return true else return false end
    155. end
    156. function isMedic(player)
    157. if tonumber(vioGetElementData ( player, "fraktion" )) == 10 then return true else return false end
    158. end
    159. function isMechaniker(player)
    160. if tonumber(vioGetElementData ( player, "fraktion" )) == 11 then return true else return false end
    161. end
    162. function isBallas(player)
    163. if tonumber(vioGetElementData ( player, "fraktion" )) == 12 then return true else return false end
    164. end
    165. function isGrove(player)
    166. if tonumber(vioGetElementData ( player, "fraktion" )) == 13 then return true else return false end
    167. end
    168. function isBloods(player)
    169. if tonumber(vioGetElementData ( player, "fraktion" )) == 14 then return true else return false end
    170. end
    171. ------------------------------------------------------------------------------------------------------
    172. function isStateFaction(player)
    173. if isArmy(player) or isCop(player) or isFBI(player) then return true else return false end
    174. end
    175. function isOnStateDuty(player)
    176. return isOnDuty(player)
    177. end
    178. function isOnDuty(player)
    179. local model = getElementModel(player)
    180. if isCop (player) then
    181. for i=1, #factionSkins[1] do
    182. if factionSkins[1][i] == model then
    183. return true
    184. end
    185. end
    186. elseif isFBI (player) then
    187. for i=1, #factionSkins[6] do
    188. if factionSkins[6][i] == model then
    189. return true
    190. end
    191. end
    192. elseif isArmy (player) then
    193. for i=1, #factionSkins[8] do
    194. if factionSkins[8][i] == model then
    195. return true
    196. end
    197. end
    198. end
    199. return false
    200. end
    201. function isEmergencyOnDuty(player)
    202. local model = getElementModel(player)
    203. if isMedic (player) then
    204. for i=1, #factionSkins[10] do
    205. if factionSkins[10][i] == model then
    206. return true
    207. end
    208. end
    209. elseif isMechaniker (player) then
    210. for i=1, #factionSkins[11] do
    211. if factionSkins[11][i] == model then
    212. return true
    213. end
    214. end
    215. end
    216. return false
    217. end
    218. function isAbleOffduty ( player )
    219. local model = getElementModel(player)
    220. for i=1, #factionSkins[1] do
    221. if factionSkins[1][i] == model then
    222. return true
    223. end
    224. end
    225. for i=1, #factionSkins[6] do
    226. if factionSkins[6][i] == model then
    227. return true
    228. end
    229. end
    230. for i=1, #factionSkins[8] do
    231. if factionSkins[8][i] == model then
    232. return true
    233. end
    234. end
    235. return false
    236. end
    237. function isEvil(player)
    238. if isMafia(player) or isTriad(player) or isTerror(player) or isAztecas(player) or isBiker(player) or isBallas(player) or isGrove(player) or isBloods(player) then return true else return false end
    239. end
    240. function isEmergency(player)
    241. if isMedic(player) or isMechaniker(player) then return true else return false end
    242. end
    243. function isInDepotFaction(player)
    244. return true
    245. end
    246. ---------------------------------------------------------------------------------------------------
    247. function sendMSGForFaction ( msg, faction, r, g, b )
    248. if not r then
    249. local r, g, b = 200, 200, 100
    250. end
    251. for playeritem, key in pairs ( fraktionMembers[faction] ) do
    252. outputChatBox ( msg, playeritem, r, g, b )
    253. end
    254. end
    255. function getFactionMembersOnline ( faction )
    256. if faction then
    257. counter = 0
    258. for playeritem, index in pairs ( fraktionMembers[faction] ) do
    259. counter = counter + 1
    260. end
    261. return counter
    262. else
    263. return false
    264. end
    265. end
    266. function policeComputer ( presser, key, state )
    267. if state == "down" and isOnDuty(presser) and isFederalCar ( getPedOccupiedVehicle ( presser ) ) and getElementModel ( getPedOccupiedVehicle ( presser ) ) ~= 520 then
    268. triggerClientEvent ( presser,"showPDComputer", getRootElement() )
    269. end
    270. end
    271. function createTeleportMarker ( x1, y1, z1, int1, dim1, x2, y2, z2, int2, dim2, rot, needetFaction )
    272. if not needetFaction then
    273. needetFaction = 0
    274. end
    275. local marker1 = createMarker ( x1, y1, z1 + 0.5, "corona", 1, 0, 0, 0, 0 )
    276. local marker2 = createMarker ( x1, y1, z1, "cylinder", 1, 255, 0, 0, 150 )
    277. setElementDimension ( marker1, dim1 )
    278. setElementDimension ( marker2, dim1 )
    279. setElementInterior ( marker1, int1 )
    280. setElementInterior ( marker2, int1 )
    281. addEventHandler ( "onMarkerHit", marker1,
    282. function ( hit, dim )
    283. if dim then
    284. if getElementType ( hit ) == "player" then
    285. if not getPedOccupiedVehicle ( hit ) then
    286. if needetFaction == 0 or vioGetElementData ( hit, "fraktion" ) == needetFaction then
    287. fadeElementInterior ( hit, int2, x2, y2, z2, rot, dim2 )
    288. else
    289. infobox ( hit, "Du bist nicht\nbefugt!", 5000, 125, 0, 0 )
    290. end
    291. end
    292. end
    293. end
    294. end
    295. )
    296. end
    297. function createFactionVehicle ( model, x, y, z, rx, ry, rz, faction, c1, c2, c3, c4, numberplate )
    298. if not c3 then
    299. c3 = 0
    300. end
    301. if not c4 then
    302. c4 = 0
    303. end
    304. if not numberplate then
    305. numberplate = fraktionNames[faction]
    306. end
    307. local veh = createVehicle ( model, x, y, z, rx, ry, rz, numberplate )
    308. setVehicleColor ( veh, c1, c2, c3, c4 )
    309. setElementHealth ( veh, 1700 )
    310. setVehiclePaintjob ( veh, 3 )
    311. toggleVehicleRespawn ( veh, true )
    312. setVehicleRespawnDelay ( veh, FCarDestroyRespawn * 1000 * 60 )
    313. setVehicleIdleRespawnDelay ( veh, FCarIdleRespawn * 1000 * 60 )
    314. factionVehicles[faction][veh] = true
    315. vioSetElementData ( veh, "owner", fraktionNames[faction] )
    316. vioSetElementData ( veh, "ownerfraktion", faction )
    317. vioSetElementData ( veh, "sportmotor", ( faction == 10 and 3 or 2 ) )
    318. vioSetElementData ( veh, "bremse", ( faction == 10 and 3 or 2 ) )
    319. vioSetElementData ( veh, "antrieb", "awd" )
    320. setElementFrozen ( veh, true )
    321. if faction ~= 1 and faction ~= 6 and faction ~= 8 then
    322. addEventHandler ( "onVehicleStartEnter", veh, function ( player, seat, jacked )
    323. if seat == 0 and vioGetElementData ( player, "fraktion" ) ~= faction then
    324. if not jacked then
    325. cancelEvent ()
    326. end
    327. else
    328. setElementFrozen ( source, false )
    329. end
    330. end )
    331. addEventHandler ( "onVehicleEnter", veh, function ( player, seat, jacked )
    332. if seat == 0 and vioGetElementData ( player, "fraktion" ) ~= faction and jacked then
    333. setElementVelocity ( source, 0, 0, 0 )
    334. setControlState ( player, "enter_exit", false )
    335. setTimer ( removePedFromVehicle, 750, 1, player )
    336. setTimer ( setControlState, 150, 1, player, "enter_exit", false )
    337. setTimer ( setControlState, 200, 1, player, "enter_exit", true )
    338. setTimer ( setControlState, 700, 1, player, "enter_exit", false )
    339. infobox ( player, "Du bist keiner\nvon "..fraktionNames[faction].."!", 4000, 255, 0, 0 )
    340. end
    341. end )
    342. else
    343. addEventHandler ( "onVehicleStartEnter", veh, function ( player, seat, jacked )
    344. if seat == 0 and not isOnDuty ( player ) then
    345. if not jacked then
    346. cancelEvent ()
    347. end
    348. else
    349. setElementFrozen ( source, false )
    350. end
    351. end )
    352. addEventHandler ( "onVehicleEnter", veh, function ( player, seat, jacked )
    353. if seat == 0 and not isOnDuty ( player ) and jacked then
    354. setControlState ( player, "enter_exit", false )
    355. setTimer ( removePedFromVehicle, 750, 1, player )
    356. setTimer ( setControlState, 150, 1, player, "enter_exit", false )
    357. setTimer ( setControlState, 200, 1, player, "enter_exit", true )
    358. setTimer ( setControlState, 700, 1, player, "enter_exit", false )
    359. infobox ( player, "Du bist keiner\nvon "..fraktionNames[faction].."!", 4000, 255, 0, 0 )
    360. end
    361. end )
    362. end
    363. if faction == 1 then
    364. addEventHandler ( "onVehicleEnter", veh,
    365. function ( player, seat )
    366. local veh = source
    367. if not isKeyBound ( player, "sub_mission", "down", policeComputer ) then
    368. bindKey ( player, "sub_mission", "down", policeComputer )
    369. end
    370. end )
    371. elseif faction == 6 then
    372. addEventHandler ( "onVehicleEnter", veh,
    373. function ( player, seat )
    374. local veh = source
    375. if not isKeyBound ( player, "sub_mission", "down", policeComputer ) then
    376. bindKey ( player, "sub_mission", "down", policeComputer )
    377. end
    378. end )
    379. elseif faction == 8 then
    380. addEventHandler ( "onVehicleEnter", veh,
    381. function ( player, seat )
    382. local veh = source
    383. if getPedOccupiedVehicleSeat ( player ) == 0 then
    384. if not isKeyBound ( player, "sub_mission", "down", policeComputer ) and getElementModel ( veh ) ~= 520 then
    385. bindKey ( player, "sub_mission", "down", policeComputer )
    386. end
    387. if getElementModel ( veh ) == 433 then
    388. setElementHealth ( player, 100 )
    389. setPedArmor ( player, 100 )
    390. setElementHunger ( player, 100 )
    391. elseif getElementModel ( veh ) == 432 then
    392. if vioGetElementData ( player, "job" ) ~= "tankcommander" then
    393. opticExitVehicle ( player )
    394. outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
    395. end
    396. elseif getElementModel ( veh ) == 425 or getElementModel ( veh ) == 520 then
    397. if vioGetElementData ( player, "job" ) ~= "air" then
    398. opticExitVehicle ( player )
    399. outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
    400. end
    401. elseif getElementModel ( veh ) == 563 or getElementModel ( veh ) == 595 then
    402. if vioGetElementData ( player, "job" ) ~= "marine" and seat == 0 then
    403. opticExitVehicle ( player )
    404. outputChatBox ( "Du hast nicht die erforderliche Klasse!", player, 125, 0, 0 )
    405. else
    406. giveWeapon ( player, 46, 3, true )
    407. end
    408. end
    409. else
    Alles anzeigen
    das ist die allround.lua bis zur 500. Zeile, hab eigentlich drauf geachtet was ich eingebe was die Bloods Fraktion angeht...
  • Neu

    McJoker schrieb:

    function createFactionVehicle ( model, x, y, z, rx, ry, rz, faction, c1, c2, c3, c4, numberplate )

    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 )
    Ist Vorhanden also daran liegt das nicht. Also hast du die Fraktion falsch eingefügt.
  • Neu

    Matze Gam1ngTv schrieb:

    Wenn er die Fraktion nicht richtig eingetragen hat dann kanns auch nicht gehen.
    Da ich den Code genau so umgebaut habe das er für das Ultimate geht.
    Ich darf darauf hinweisen wenn er die Funktion nicht findet ist es scheis egal ob er die Fraktion eingetragen hat oder nicht denn dann geht auch nichts wenn er es überall eingetragen hat

    #LeseDenError

    Lg