Tazer fehler

  • Ultimate

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Hallo,

    bei mir funkt akuell der Tazer net

    Fehler : imgur.com/a/uavGIKr



    LUA-Quellcode

    1. function getVariableTyp ( var )
    2. if isString ( var ) then
    3. return 0
    4. elseif tostring ( var ) == "true" or tostring ( var ) == "false" then
    5. return 1
    6. elseif tonumber ( var ) then
    7. return 2
    8. end
    9. return 0
    10. end
    11. function isReallyInsideRadarArea ( theArea, x, y )
    12. local posX, posY = getElementPosition ( theArea )
    13. local sizeX, sizeY = getRadarAreaSize ( theArea )
    14. return (x >= posX) and (x <= posX + sizeX) and (y >= posY) and (y <= posY + sizeY)
    15. end
    16. freeDimensions = {}
    17. function sortArray ( tbl )
    18. local array = {}
    19. local size = table.size ( tbl )
    20. local curBiggest = 0
    21. local curID = 0
    22. for k = 1, size do
    23. for i = 1, size do
    24. if tbl[i] > curBiggest then
    25. curBiggest = tbl[i]
    26. curID = i
    27. end
    28. end
    29. array[k] = curBiggest
    30. tbl[curID] = 0
    31. curBiggest = 0
    32. end
    33. return array
    34. end
    35. function outputArray ( table )
    36. for i = 1, 5 do
    37. outputServerLog ( "Value: "..table[i] )
    38. end
    39. end
    40. function isPedAiming ( ped )
    41. if getLocalPlayer then
    42. return getPedControlState ( ped, "aim_weapon" )
    43. else
    44. return getPedControlState ( ped, "aim_weapon" )
    45. end
    46. return false
    47. end
    48. function damagePlayer ( player, amount, damager, weapon )
    49. local amount = amount
    50. if isElement ( player ) then
    51. local armor = getPedArmor ( player )
    52. local health = getElementHealth ( player )
    53. local died = false
    54. if armor > 0 then
    55. if armor >= amount then
    56. setPedArmor ( player, armor - amount )
    57. else
    58. setPedArmor ( player, 0 )
    59. local newamount = amount - armor
    60. if health - newamount <= 0 then
    61. killPed ( player, damager, weapon, 3, false )
    62. amount = armor + health
    63. died = true
    64. else
    65. setElementHealth ( player, health - newamount )
    66. end
    67. end
    68. else
    69. if health - amount <= 0 then
    70. amount = health
    71. killPed ( player, damager, weapon, 3, false )
    72. died = true
    73. else
    74. setElementHealth ( player, health - amount )
    75. end
    76. end
    77. if not died then
    78. vioSetElementData ( player, "lasthp", getElementHealth ( player )+ getPedArmor ( player ))
    79. end
    80. vioSetElementData ( player, "DamageBekommen", vioGetElementData ( player, "DamageBekommen" ) + amount )
    81. vioSetElementData ( damager, "DamageGemacht", vioGetElementData ( damager, "DamageGemacht" ) + amount )
    82. end
    83. end
    84. function formNumberToMoneyString ( value )
    85. if tonumber ( value ) then
    86. value = tostring ( value )
    87. if string.sub ( value, 1, 1 ) == "-" then
    88. return "-"..setDotsInNumber ( string.sub ( value, 2, #value ) ).." $"
    89. else
    90. return setDotsInNumber ( value ).." $"
    91. end
    92. end
    93. return false
    94. end
    95. function setDotsInNumber ( value )
    96. if #value > 3 then
    97. return setDotsInNumber ( string.sub ( value, 1, #value - 3 ) ).."."..string.sub ( value, #value - 2, #value )
    98. else
    99. return value
    100. end
    101. end
    102. function isPlayerUnarmed ( player )
    103. for i = 2, 8 do
    104. if getPedWeapon ( player, i ) > 0 then
    105. if getPedTotalAmmo ( player, i ) > 0 then
    106. return false
    107. end
    108. end
    109. end
    110. return true
    111. end
    112. function getFreeDimension ()
    113. for i = 1, 10 do
    114. local rnd = math.random ( 10, 65000 )
    115. if not freeDimensions[rnd] then
    116. freeDimensions[rnd] = true
    117. return rnd
    118. end
    119. end
    120. return 0
    121. end
    122. function setMoveable ( player, bool )
    123. if lp then
    124. bool = player
    125. elseif isElement ( player ) then
    126. end
    127. end
    128. function timestampOptical ()
    129. local regtime = getRealTime()
    130. local year = regtime.year + 1900
    131. local month = regtime.month+1
    132. local day = regtime.monthday
    133. local hour = regtime.hour
    134. local minute = regtime.minute
    135. return tostring(day.."."..month.."."..year..", "..hour..":"..minute)
    136. end
    137. monthDays = {
    138. [1]=31,
    139. [2]=28,
    140. [3]=31,
    141. [4]=30,
    142. [5]=31,
    143. [6]=30,
    144. [7]=31,
    145. [8]=31,
    146. [9]=30,
    147. [10]=31,
    148. [11]=30,
    149. [12]=31
    150. }
    151. function getDaysInMonth ( month, year )
    152. local leap = isYearALeapYear ( year )
    153. if month == 2 and leap then
    154. return 29
    155. else
    156. return monthDays[month]
    157. end
    158. end
    159. function isYearALeapYear(year)
    160. if (not year) then year = getRealTime().year + 1900 end
    161. return ((year % 4 == 0 and year % 100 ~= 0) or year % 400 == 0)
    162. end
    163. function toggleVehicleTrunk ( veh )
    164. if vioGetElementData ( veh, "stuning1" ) then
    165. local vx, vy, vz = getElementVelocity ( veh )
    166. local x, y, z = getElementPosition ( veh )
    167. setElementFrozen ( veh, true )
    168. setElementPosition ( veh, x, y, z - 50 )
    169. local state = vioGetElementData ( veh, "trunkState" )
    170. if vioGetElementData ( veh, "trunkState" ) == nil then
    171. vioSetElementData ( veh, "trunkState", false )
    172. setVehicleDoorState ( veh, 1, 0 )
    173. state = false
    174. end
    175. vioSetElementData ( veh, "trunkState", not state )
    176. if state then
    177. setVehicleDoorState ( veh, 1, 0 )
    178. else
    179. setVehicleDoorState ( veh, 1, 4 )
    180. end
    181. setElementFrozen ( veh, false )
    182. setElementPosition ( veh, x, y, z )
    183. setElementVelocity ( veh, vx, vy, vz )
    184. end
    185. end
    186. function getVehicleTrunkState ( veh )
    187. if vioGetElementData ( veh, "trunkState" ) then
    188. return true
    189. end
    190. return false
    191. end
    192. function getDistanceBetweenMinutes ( m1, h1, m2, h2 )
    193. local t1 = m1 + h1 * 60
    194. local t2 = m2 + h2 * 60
    195. if t2 == t1 then
    196. return 0
    197. elseif t2 > t1 then
    198. return t2 - t1
    199. else
    200. return math.abs ( 1440 - t1 + t2 )
    201. end
    202. end
    203. function attachElementsInCorrectWay ( element1, element2 )
    204. local x1, y1, z1 = getElementPosition ( element1 )
    205. --local rx1, ry1, rz1 = getElementRotation ( element1 )
    206. local x2, y2, z2 = getElementPosition ( element2 )
    207. --local rx2, ry2, rz2 = getElementRotation ( element1 )
    208. attachElements ( element1, element2, x1-x2, y1-y2, z1-z2--[[, rx1-rx2, ry1-ry2, rz1-rz2]] )
    209. end
    210. function attachElementsInVeryCorrectWay ( element1, element2 )
    211. local x1, y1, z1 = getElementPosition ( element1 )
    212. local rx1, ry1, rz1 = getElementRotation ( element1 )
    213. local x2, y2, z2 = getElementPosition ( element2 )
    214. local rx2, ry2, rz2 = getElementRotation ( element1 )
    215. attachElements ( element1, element2, x1-x2, y1-y2, z1-z2, rx2, ry2, rz2 )
    216. end
    217. function table.copy(tab)
    218. local ret = {}
    219. for key, value in pairs(tab) do
    220. if ( type ( value ) == "table" ) then
    221. ret [ key ] = table.copy ( value )
    222. else
    223. ret [ key ] = value
    224. end
    225. end
    226. return ret
    227. end
    228. function table.size ( tab )
    229. local length = 0
    230. for _ in pairs ( tab ) do length = length + 1 end
    231. return length
    232. end
    233. function findRotation ( x1, y1, x2, y2 )
    234. local t = - math.deg ( math.atan2 ( x2 - x1, y2 - y1 ) )
    235. if t < 0 then t = t + 360 end
    236. return t
    237. end
    238. function getPointFromDistanceRotation ( x, y, dist, angle )
    239. local a = math.rad ( 90 - angle )
    240. local dx = math.cos ( a ) * dist
    241. local dy = math.sin ( a ) * dist
    242. return x + dx, y + dy
    243. end
    244. function isString ( text )
    245. if not tonumber ( text ) and tostring ( text ) ~= "true" and tostring ( text ) ~= "false" and tostring ( text ) ~= "nil" then
    246. return true
    247. else
    248. return false
    249. end
    250. end
    251. function timestamp ()
    252. local regtime = getRealTime()
    253. local year = regtime.year + 1900
    254. local month = regtime.month + 1
    255. local day = regtime.monthday
    256. local hour = regtime.hour + winterzeit
    257. if hour == 24 then hour = 0 end
    258. local minute = regtime.minute
    259. local timestamp = tostring(day.."."..month.."."..year..", "..hour..":"..minute)
    260. return timestamp
    261. end
    262. function timestampDays ( add )
    263. local regtime = getRealTime()
    264. local day = regtime.monthday + add
    265. local year = regtime.year + 1900
    266. while day > 365 do
    267. day = day - 365
    268. year = year + 1
    269. end
    270. local month = regtime.month + 1
    271. local hour = regtime.hour + winterzeit
    272. if hour == 24 then hour = 0 end
    273. local minute = regtime.minute
    274. local timestamp = day.."."..month.."."..year
    275. return timestamp
    276. end
    277. function setVehicleStatic ( vehicle, boolean )
    278. if boolean then
    279. local x, y, z = getElementPosition ( vehicle )
    280. local rx, ry, rz = getElementRotation ( vehicle )
    281. local master = createObject ( 1337, x, y, z )
    282. setElementRotation ( master, rx, ry, rz )
    283. setElementAlpha ( master, 0 )
    284. --attachElementsInCorrectWay ( vehicle, master )
    285. attachElementsInCorrectWay ( vehicle, master )
    286. setVehicleDamageProof ( vehicle, true )
    287. setVehicleDoorsUndamageable ( vehicle, true )
    288. setVehicleLocked ( vehicle, true )
    289. end
    290. end
    291. function isWithinNightTime ()
    292. local time = getRealTime()
    293. local hour = time.hour
    294. if hour >= 20 or hour <= 8 then
    295. return true
    296. else
    297. return false
    298. end
    299. end
    300. function fadeElementInterior ( player, int, intx, inty, intz, rot, dim )
    301. if player and isElement ( player ) and getElementType ( player ) == "player" then
    302. if not vioGetElementData ( player, "intchange" ) then
    303. vioSetElementData ( player, "intchange", true )
    304. if lp then
    305. fadeCamera ( false, 1, 0, 0, 0 )
    306. setTimer ( fadeCamera, 1000, 1, true )
    307. setTimer ( setElementInterior, 1000, 1, player, int )
    308. setTimer ( setElementDimension, 1000, 1, player, dim )
    309. setTimer ( setElementPosition, 1000, 1, player, intx, inty, intz )
    310. if rot then
    311. setTimer ( setPedRotation, 1000, 1, player, rot )
    312. end
    313. setTimer ( vioSetElementData, 2000, 1, player, "intchange", false )
    314. else
    315. fadeCamera ( player, false, 1, 0, 0, 0 )
    316. setTimer ( fadeCamera, 1000, 1, player, true )
    317. setTimer ( setElementInterior, 1000, 1, player, int )
    318. setTimer ( setElementPosition, 1000, 1, player, intx, inty, intz )
    319. if rot then
    320. setTimer ( setPedRotation, 1000, 1, player, rot )
    321. end
    322. setTimer ( vioSetElementData, 2000, 1, player, "intchange", false )
    323. end
    324. end
    325. end
    326. end
    327. function vanishElement ( element )
    328. if isElement ( element ) then
    329. for i = 1, 25 do
    330. setTimer ( setElementAlpha, 100 * i, 1, element, 255 / 25 * ( 25 - i ) )
    331. end
    332. setTimer ( destroyElement, 2500, 1, element )
    333. end
    334. end
    335. function addPlayerHealth ( player, value )
    336. if isElement ( player ) then
    337. local total = getElementHealth ( player ) + value
    338. if total > 100 then
    339. setElementHealth ( player, 100 )
    340. else
    341. setElementHealth ( player, total )
    342. end
    343. end
    344. end
    345. function toggleChatControls ( bool )
    346. toggleControl ( "chatbox", bool )
    347. end
    348. function getSecTime ( duration )
    349. if not duration then
    350. duration = 0
    351. end
    352. local time = getRealTime()
    353. local year = time.year
    354. local day = time.yearday
    355. local hour = time.hour
    356. local minute = time.minute
    357. local total = year * 365 * 24 * 60 + day * 24 * 60 + ( hour + duration ) * 60 + minute
    358. return total
    359. end
    360. function getMinTime ()
    361. return getSecTime ( 0 )
    362. end
    363. function getSecondTime ( duration )
    364. local time = getRealTime ()
    365. local year = time.year
    366. local day = time.yearday
    367. local hour = time.hour
    368. local minute = time.minute
    369. local seconds = time.second
    370. local total = 0
    371. total = year * 365 * 24 * 60 * 60
    372. total = total + day * 24 * 60 * 60
    373. total = total + hour * 60 * 60
    374. total = total + minute * 60
    375. total = total + seconds + duration
    376. return total
    377. end
    Alles anzeigen
    mit freundlichen grüßen Jan1308
  • Was bringt es uns wenn du uns hier deine Usefull Function schickst?

    Quellcode

    1. function isPedAiming ( ped )
    2. if getLocalPlayer then
    3. return getPedControlState ( ped, "aim_weapon" )
    4. else
    5. return getPedControlState ( ped, "aim_weapon" )
    6. end
    7. return false
    8. end
    Anscheinend bekommt er den ped nicht such mal wo isPedAiming ausgefürt wird.
    [Blockierte Grafik: http://www.speedtest.net/result/5426322119.png]
    Die deutsche Sprache ist Freeware.
    Das heißt, du darfst sie uneingeschränkt nutzen. ABER(!) die deutsche Sprache ist NICHT Open Source.
    Das heißt, du darfst sie nicht nach deinen Vorstellungen verändern!

    Ein Problem ist halb gelöst, wenn es klar formuliert ist.
  • hier in der Tazer.lua+

    Quellcode

    1. function tazer_func ( player )
    2. if player == client or not client then
    3. if isOnDuty(player) then
    4. if vioGetElementData ( player, "tazer" ) == 1 then else vioSetElementData ( player, "tazer", 0 ) end
    5. if vioGetElementData ( player, "tazer" ) == 0 then
    6. if not getPedOccupiedVehicle ( player ) then
    7. local posX, posY, posZ = getElementPosition( player )
    8. local tazerSphere = createColSphere( posX, posY, posZ, 3 )
    9. local nearbyPlayers = getElementsWithinColShape( tazerSphere, "player" )
    10. destroyElement( tazerSphere )
    11. local curTazerVicitm = nil
    12. local bestDist = 999
    13. for index, nearbyPlayer in pairs ( nearbyPlayers ) do
    14. if nearbyPlayer ~= player and not getPedOccupiedVehicle ( nearbyPlayer ) and ( ( isPedAiming ( nearbyPlayer ) and getPedWeapon ( nearbyPlayer ) < 2 ) or not isPedAiming ( nearbyPlayer ) ) then
    15. local px, py, pz = getElementPosition ( nearbyPlayer )
    16. local cDist = getDistanceBetweenPoints3D ( posX, posY, posZ, px, py, pz )
    17. if cDist <= bestDist then
    18. curTazerVicitm = nearbyPlayer
    19. bestDist = cDist
    20. end
    21. end
    22. end
    23. if isElement ( curTazerVicitm ) then
    24. setPedAnimation( curTazerVicitm, "crack", "crckdeth2",-1,true,true,false)
    25. setTimer ( defreeze_tazer, 20000, 1, curTazerVicitm )
    26. vioSetElementData ( player, "tazer", 1 )
    27. setTimer ( reuse_tazer, 25000, 1, player )
    28. local posX, posY, posZ = getElementPosition( player )
    29. local chatSphere = createColSphere( posX, posY, posZ, 10 )
    30. local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" )
    31. destroyElement ( chatSphere )
    32. toggleAllControls ( curTazerVicitm, false, true, false )
    33. local pname = getPlayerName ( player )
    34. outputLog ( pname.." hat "..getPlayerName(curTazerVicitm).." getazert!", "tazer" )
    35. for i=1, #nearbyPlayers do
    36. outputChatBox ( pname.." hat "..getPlayerName(curTazerVicitm).." getazert!", nearbyPlayers[i], 100, 0, 200 )
    37. end
    38. vioSetElementData ( curTazerVicitm, "tazered", true )
    39. else
    40. triggerClientEvent ( player, "infobox_start", getRootElement(), "\nEs ist kein\nSpieler in der\nNähe!", 5000, 125, 0, 0 )
    41. end
    42. end
    43. else
    44. triggerClientEvent ( player, "infobox_start", getRootElement(), "\nTazern ist nur\nalle 25 Sekunden\nmöglich!", 5000, 125, 0, 0 )
    45. end
    46. else
    47. triggerClientEvent ( player, "infobox_start", getRootElement(), "\nDu bist kein\nPolizist im\nDienst!", 5000, 125, 0, 0 )
    48. end
    49. end
    50. end
    51. addEvent ( "tazer", true )
    52. addEventHandler ( "tazer", getRootElement(), tazer_func )
    53. addCommandHandler ( "tazer", tazer_func )
    Alles anzeigen
    mit freundlichen grüßen Jan1308