Meldung nur intern Fraktion anzeigen

  • Ultimate

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

  • Meldung nur intern Fraktion anzeigen

    Hallo wollte fragen wie man da machen kann das mann eine Meldung nur in einer Fraktion wenn man drin ist die meldugn sieht

    Code:

    LUA-Quellcode: feuerwehr_server.lua

    1. addEvent ( "extinguishFire", true )
    2. addEvent ( "cuttedFiremanTree", true )
    3. local actiondatas = { list = {}, place = 0 }
    4. local firepeds = {}
    5. local blips = {}
    6. local sounddata = {}
    7. local vehobj = {}
    8. local funcs = {}
    9. local actiontimer = {}
    10. local action = nil
    11. local actionstaytime = 0
    12. local actioncometime = 0
    13. local amountflamesatvehicle = 0
    14. local pedhealth = 0
    15. local treehealth = 0
    16. funcs.stopAction = function ( startagain )
    17. action = nil
    18. if firepeds[1] then
    19. for i=1, #firepeds do
    20. destroyElement ( firepeds[i] )
    21. end
    22. end
    23. if vehobj[1] then
    24. for i=1, #vehobj do
    25. destroyElement ( vehobj[i] )
    26. end
    27. end
    28. firepeds = {}
    29. vehobj = {}
    30. sounddata = {}
    31. if bool then
    32. setTimer ( funcs.startAction, type ( actioncometime ) == "table" and math.random ( actioncometime[1], actioncometime[2] ) or actioncometime, 1 )
    33. end
    34. end
    35. local function createPedForFire ( x, y, z, parent, path, volume )
    36. local counter = #firepeds + 1
    37. firepeds[counter] = createPed ( 0, x, y, z, 0, false )
    38. setElementData ( firepeds[counter], "health", ( pedhealth == "table" and math.random ( pedhealth[1], pedhealth[2] ) or pedhealth ) )
    39. setPedAnimation ( firepeds[counter], "cop_ambient", "coplook_in", -1, true, false, false, true )
    40. setElementAlpha ( firepeds[counter], 0 )
    41. setElementFrozen ( firepeds[counter], true )
    42. local blipcounter = #blips + 1
    43. blips[blipcounter] = createBlipAttachedTo ( firepeds[counter], 0, 2, 255, 0, 0, 255, 0, 99999 )
    44. setElementVisibleTo ( blips[blipcounter], root, false )
    45. for playeritem, key in pairs ( fraktionMembers[10] ) do
    46. setElementVisibleTo ( blips[blipcounter], playeritem, true )
    47. end
    48. setElementParent ( blips[blipcounter], firepeds[counter] )
    49. if parent then
    50. setElementParent ( firepeds[counter], parent )
    51. end
    52. if path then
    53. sounddata[firepeds[counter]] = { path, volume or 1 }
    54. end
    55. end
    56. funcs.startAction = function ( )
    57. funcs.stopAction ( false )
    58. action = actiondatas.list[math.random ( #actiondatas.list )]
    59. actiondatas.place = math.random ( #actiondatas[action] )
    60. for i=1, #actiondatas[action][actiondatas.place] do
    61. local array = actiondatas[action][actiondatas.place][i]
    62. local dataplace = #vehobj+1
    63. if array.typ == "vehicle" then
    64. vehobj[dataplace] = createVehicle ( array.model, array.posX, array.posY, array.posZ, array.rotX, array.rotY, array.rotZ, "Unfall" )
    65. setVehicleDoorState ( vehobj[dataplace], 0, 3 )
    66. for i=1, 5 do
    67. setVehicleDoorState ( vehobj[dataplace], i, 2 )
    68. end
    69. setElementHealth ( vehobj[dataplace], 251 )
    70. setVehicleColor ( vehobj[dataplace], array.r, array.g, array.b )
    71. setVehicleDamageProof ( vehobj[dataplace], true )
    72. setVehicleDoorsUndamageable ( vehobj[dataplace], true )
    73. setVehicleEngineState ( vehobj[dataplace], false )
    74. toggleVehicleRespawn ( vehobj[dataplace], false )
    75. setVehicleLocked ( vehobj[dataplace], true )
    76. setElementFrozen ( vehobj[dataplace], true )
    77. local counter = #firepeds
    78. local limit = type ( amountflamesatvehicle ) == "table" and math.random ( amountflamesatvehicle[1], amountflamesatvehicle[2] ) or amountflamesatvehicle
    79. while counter < limit do
    80. counter = counter + 1
    81. local x, y = math.random ( -300, 300 ) / 100, math.random ( -300, 300 ) / 100
    82. createPedForFire ( array.posX+x, array.posY+y, array.posZ, vehobj[dataplace] )
    83. end
    84. if array.soundpath then
    85. sounddata[vehobj[dataplace]] = { array.soundpath, array.volume or 1 }
    86. end
    87. elseif array.typ == "object" then
    88. vehobj[dataplace] = createObject ( array.model, array.posX, array.posY, array.posZ, array.rotX, array.rotY, array.rotZ )
    89. setObjectScale ( vehobj[dataplace], array.scale )
    90. setElementFrozen ( vehobj[dataplace], true )
    91. if array.soundpath then
    92. sounddata[vehobj[dataplace]] = { array.soundpath, array.volume or 1 }
    93. end
    94. if action ~= "tree" then
    95. createPedForFire ( array.posX, array.posY, array.posZ, vehobj[dataplace], array.soundpath, array.volume )
    96. else
    97. setElementData ( vehobj[dataplace], "health", ( treehealth == "table" and math.random ( treehealth[1], treehealth[2] ) or treehealth ) )
    98. local blipcounter = #blips + 1
    99. blips[blipcounter] = createBlipAttachedTo ( vehobj[dataplace], 0, 2, 255, 0, 0, 255, 0, 99999 )
    100. setElementVisibleTo ( blips[blipcounter], root, false )
    101. for playeritem, key in pairs ( fraktionMembers[10] ) do
    102. setElementVisibleTo ( blips[blipcounter], playeritem, true )
    103. end
    104. setElementParent ( blips[blipcounter], vehobj[dataplace] )
    105. end
    106. elseif array.typ == "fire" then
    107. createPedForFire ( array.posX, array.posY, array.posZ, nil, array.soundpath, array.volume )
    108. end
    109. end
    110. local x, y, z = actiondatas[action][actiondatas.place][1].posX, actiondatas[action][actiondatas.place][1].posY, actiondatas[action][actiondatas.place][1].posZ
    111. if action == "fire" then
    112. outputChatBox ( "[FEUER] Achtung: Ein Brand wurde ausgelöst! Ort: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ), root, 200, 0, 0 )
    113. --outputDebugString ( "[FEUER] Achtung: Ein Brand wurde ausgelöst! Ort: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ).." - "..tostring ( x )..", "..tostring ( y )..", "..tostring ( z ) )
    114. elseif action == "tree" then
    115. outputChatBox ( "[BAUM] Achtung: Ein Baum ist umgefallen! Ort: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ), root, 200, 0, 0 )
    116. --outputDebugString ( "[BAUM] Achtung: Ein Baum ist umgefallen! Ort: "..getZoneName ( x, y, z )..", "..getZoneName ( x, y, z, true ).." - "..tostring ( x )..", "..tostring ( y )..", "..tostring ( z ) )
    117. end
    118. triggerLatentClientEvent ( "startActionForFiremen", 30000, false, resourceRoot, pedhealth, action, sounddata, vehobj, firepeds )
    119. actiontimer.stop = setTimer ( funcs.stopAction, type ( actioncometime ) == "table" and math.random ( actioncometime[1], actioncometime[2] ) or actioncometime, 1, true )
    120. end
    121. addEventHandler ( "extinguishFire", root, function ( ped )
    122. for i=1, #firepeds do
    123. if firepeds[i] == ped then
    124. destroyElement ( ped )
    125. table.remove ( firepeds, i )
    126. break
    127. end
    128. end
    129. if not firepeds[1] then
    130. outputChatBox ( "[FEUER] Das Feuer konnte gelöscht werden!", root, 0, 200, 0 )
    131. funcs.stopAction ( true )
    132. end
    133. end )
    134. addEventHandler ( "cuttedFiremanTree", root, function ( tree )
    135. for i=1, #vehobj do
    136. if vehobj[i] == tree then
    137. destroyElement ( tree )
    138. table.remove ( vehobj, i )
    139. break
    140. end
    141. end
    142. if not vehobj[1] then
    143. outputChatBox ( "[BAUM] Der Baum konnte entfernt werden!", root, 0, 200, 0 )
    144. funcs.stopAction ( true )
    145. end
    146. end )
    147. addEventHandler ( "onPlayerJoin", root, function ( )
    148. if action then
    149. triggerLatentClientEvent ( source, "startActionForFiremen", 30000, false, resourceRoot, pedhealth, action, sounddata, vehobj, firepeds )
    150. end
    151. end )
    152. local function vioFiremanActionThings ( )
    153. if fileExists ( "firemenactions.xml" ) then
    154. local xml = xmlLoadFile ( "firemenactions.xml" )
    155. local nodes = xmlNodeGetChildren ( xml )
    156. if nodes and nodes[1] then
    157. for i=1, #nodes do
    158. local nodename = xmlNodeGetName ( nodes[i] )
    159. if nodename == "settings" then
    160. local actionstaynode = xmlFindChild ( nodes[i], "actionstaytime", 0 )
    161. actionstaytime = actionstaynode and tonumber ( xmlNodeGetAttribute ( actionstaynode, "time" ) ) or 1800000
    162. local actioncomenode = xmlFindChild ( nodes[i], "actioncometime", 0 )
    163. local actioncometime2 = actioncomenode and xmlNodeGetAttribute ( actioncomenode, "time2", 0 ) or ""
    164. actioncometime = actioncomenode and ( actioncometime2 ~= "" and { tonumber ( xmlNodeGetAttribute ( actioncomenode, "time1", 0 ) ), tonumber ( actioncometime2 ) } or tonumber ( xmlNodeGetAttribute ( actioncomenode, "time1", 0 ) ) ) or 3600000
    165. local amountflamesatvehiclenode = xmlFindChild ( nodes[i], "amountflamesatvehicle", 0 )
    166. local amountflamesatvehicle2 = amountflamesatvehiclenode and xmlNodeGetAttribute ( amountflamesatvehiclenode, "amount2", 0 ) or ""
    167. amountflamesatvehicle = amountflamesatvehiclenode and ( amountflamesatvehicle2 ~= "" and { tonumber ( xmlNodeGetAttribute ( amountflamesatvehiclenode, "amount1", 0 ) ), tonumber ( amountflamesatvehicle2 ) } or tonumber ( xmlNodeGetAttribute ( amountflamesatvehiclenode, "amount1", 0 ) ) ) or 3600000
    168. local pedhealthnode = xmlFindChild ( nodes[i], "actioncometime", 0 )
    169. local pedhealth2 = pedhealthnode and xmlNodeGetAttribute ( pedhealthnode, "amount2", 0 ) or ""
    170. pedhealth = pedhealthnode and ( pedhealth2 ~= "" and { tonumber ( xmlNodeGetAttribute ( pedhealthnode, "amount1", 0 ) ), tonumber ( pedhealth2 ) } or tonumber ( xmlNodeGetAttribute ( pedhealthnode, "amount1", 0 ) ) ) or 90
    171. local treehealthnode = xmlFindChild ( nodes[i], "actioncometime", 0 )
    172. local treehealth2 = treehealthnode and xmlNodeGetAttribute ( treehealthnode, "amount2", 0 ) or ""
    173. treehealth = treehealthnode and ( treehealth2 ~= "" and { tonumber ( xmlNodeGetAttribute ( treehealthnode, "amount1", 0 ) ), tonumber ( treehealth2 ) } or tonumber ( xmlNodeGetAttribute ( treehealthnode, "amount1", 0 ) ) ) or 90
    174. else
    175. if not actiondatas[nodename] then
    176. actiondatas[nodename] = {}
    177. end
    178. actiondatas.list[#actiondatas.list+1] = nodename
    179. local actionnodes = xmlNodeGetChildren ( nodes[i] )
    180. if actionnodes and actionnodes[1] then
    181. for i=1, #actionnodes do
    182. local place = #actiondatas[nodename]+1
    183. actiondatas[nodename][place] = {}
    184. local actionthings = xmlNodeGetChildren ( actionnodes[i] )
    185. if actionthings and actionthings[1] then
    186. for i=1, #actionthings do
    187. local name = xmlNodeGetName ( actionthings[i] )
    188. local dataplace = #actiondatas[nodename][place] + 1
    189. actiondatas[nodename][place][dataplace] = {
    190. typ = name,
    191. posX = tonumber ( xmlNodeGetAttribute ( actionthings[i], "posX" ) ),
    192. posY = tonumber ( xmlNodeGetAttribute ( actionthings[i], "posY" ) ),
    193. posZ = tonumber ( xmlNodeGetAttribute ( actionthings[i], "posZ" ) ),
    194. volume = tonumber ( xmlNodeGetAttribute ( actionthings[i], "volume" ) ),
    195. soundpath = xmlNodeGetAttribute ( actionthings[i], "soundpath" ),
    196. }
    197. if name == "vehicle" then
    198. actiondatas[nodename][place][dataplace].model = tonumber ( xmlNodeGetAttribute ( actionthings[i], "model" ) )
    199. actiondatas[nodename][place][dataplace].rotX = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotX" ) ) or 0
    200. actiondatas[nodename][place][dataplace].rotY = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotY" ) ) or 0
    201. actiondatas[nodename][place][dataplace].rotZ = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotZ" ) ) or 0
    202. actiondatas[nodename][place][dataplace].r = tonumber ( xmlNodeGetAttribute ( actionthings[i], "r" ) ) or 0
    203. actiondatas[nodename][place][dataplace].g = tonumber ( xmlNodeGetAttribute ( actionthings[i], "g" ) ) or 0
    204. actiondatas[nodename][place][dataplace].b = tonumber ( xmlNodeGetAttribute ( actionthings[i], "b" ) ) or 0
    205. elseif name == "object" then
    206. actiondatas[nodename][place][dataplace].model = tonumber ( xmlNodeGetAttribute ( actionthings[i], "model" ) )
    207. actiondatas[nodename][place][dataplace].rotX = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotX" ) ) or 0
    208. actiondatas[nodename][place][dataplace].rotY = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotY" ) ) or 0
    209. actiondatas[nodename][place][dataplace].rotZ = tonumber ( xmlNodeGetAttribute ( actionthings[i], "rotZ" ) ) or 0
    210. actiondatas[nodename][place][dataplace].scale = tonumber ( xmlNodeGetAttribute ( actionthings[i], "scale" ) ) or 1
    211. end
    212. end
    213. end
    214. end
    215. end
    216. end
    217. end
    218. setTimer ( funcs.startAction, type ( actioncometime ) == "table" and math.random ( actioncometime[1], actioncometime[2] ) or actioncometime, 1 )
    219. end
    220. xmlUnloadFile ( xml )
    221. end
    222. end
    223. addCommandHandler ( "reloadexml", vioFiremanActionThings, true )
    224. addEventHandler ( "onResourceStart", resourceRoot, vioFiremanActionThings )
    225. addCommandHandler ( "feuerstart321", funcs.startAction )
    Alles anzeigen
    mit freundlichen grüßen Jan1308
  • Zum Hilfreichsten Beitrag springen

  • LUA-Quellcode

    1. function sendMSGForFaction ( msg, faction, r, g, b )
    2. if not r then
    3. local r, g, b = 200, 200, 100
    4. end
    5. for playeritem, key in pairs ( fraktionMembers[faction] ) do
    6. outputChatBox ( msg, playeritem, r, g, b )
    7. end
    8. end

    LUA-Quellcode

    1. sendMSGForFaction(msg, faction, r, g, b)
    //Edit:
    Die Funktion ist aus dem Ultimate Script, somit musst du sie nur noch verwenden.
  • Nevo schrieb:

    oder so, ist halt komplexer:

    LUA-Quellcode

    1. for _,players in ipairs(getElementsByType("player")) do
    2. if vioGetElementData(players,"fraktion") == 15 then
    3. outputChatBox("", players) --Nachricht
    4. end
    5. end
    -handy
    Wenn er doch das ultimate Script benutzt, wäre es doch unnötig eine neue Funktion zu schreiben
    Es gibt Leute, die geizen mit ihrem Verstand wie andere mit ihrem Geld

    n0perius-Reallife - Open Source (In Entwicklung)

    Mein GitHub: GitHub
    Discord: n0pe#9960
    Steam: n0pe
    Teamspeak: Visual-Life