Fahrschule buggt :o

  • Vio Lite/Extended

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

  • Fahrschule buggt :o

    Moin,

    folgendes Problem: wenn meine User ins Rathaus gehen und Ihre Fahrprüfung machen wollen, muss man ja bekanntlich durch die Roten Marker fahren aber die verschwinden nicht.
    Somit kann man den Führerschein nicht machen.

    WIESO?

    Danke für eure Hilfe.

    MFG

    DamN65

    Black schrieb:

    Och hoffe ihr bekommt mal ein Blitz ins Auge

    Es gibt Leute, die geizen mit ihrem Verstand wie andere mit ihrem Geld

    Mein Ultimate Edit: github.com/n0pe97/Ultimate-Edit

    Mein GitHub: GitHub
    Discord: n0pe#3317
    Teamspeak: Visual-Life

    Beitrag von Str0 ()

    Dieser Beitrag wurde von Audifire gelöscht ().
  • Spoiler anzeigen

    LUA-Quellcode: drivingschool_client

    1. local drivingSchoolCorrectQuestions, drivingSchoolCurQuestion
    2. local drivingLicenses = {}
    3. drivingLicenses["question"] = {
    4. [1]="Was darfst du am Steuer NICHT?",
    5. [2]="Was ist eine Grundregel des Straßenverkehrs?",
    6. [3]="Wo darfst du NICHT parken?",
    7. [4]="Was tust du, wenn du einen Verkehrsunfall bauen solltest?",
    8. [5]="Weshalb ist das telefonieren während der Fahrt verboten?",
    9. [6]="Was tust du an einem Stopschild?",
    10. [7]="Was gilt in einer Einbahnstraße?"
    11. }
    12. drivingLicenses["answereA"] = {
    13. [1]="Radiosender ändern",
    14. [2]="Rechts vor Links",
    15. [3]="Auf Parkplätzen",
    16. [4]="Anhalten und die Sache\nklären",
    17. [5]="Weil es Spass macht",
    18. [6]="Kurz anhalten",
    19. [7]="Nichts besonderes"
    20. }
    21. drivingLicenses["answereB"] = {
    22. [1]="SMS schreiben",
    23. [2]="Schönheit vor Alter",
    24. [3]="Auf einer Einfahrt",
    25. [4]="Wegfahren",
    26. [5]="Es kann die Elektronik\nstören",
    27. [6]="Durchfahren",
    28. [7]="Wenden verboten"
    29. }
    30. drivingLicenses["answereC"] = {
    31. [1]="Umsehen",
    32. [2]="Wer zuerst kommt ...",
    33. [3]="Auf der Straße",
    34. [4]="Weglaufen",
    35. [5]="Grundlos",
    36. [6]="Parken",
    37. [7]="Parken verboten"
    38. }
    39. drivingLicenses["answereD"] = {
    40. [1]="Rauchen",
    41. [2]="Keines von den oberen",
    42. [3]="Auf Privatgrundstücken",
    43. [4]="Nichts",
    44. [5]="Weil man abgelenkt\nist",
    45. [6]="Umdrehen",
    46. [7]="Anhalten"
    47. }
    48. drivingLicenses["correct"] = {
    49. [1]=2,
    50. [2]=1,
    51. [3]=3,
    52. [4]=1,
    53. [5]=4,
    54. [6]=1,
    55. [7]=2
    56. }
    57. function startDrivingLicenseTheory_func ()
    58. showCursor ( true )
    59. setElementClicked ( true )
    60. drivingSchoolCorrectQuestions = 0
    61. drivingSchoolCurQuestion = 1
    62. showDrivingLicenseQuestion ( 1 )
    63. end
    64. addEvent ( "startDrivingLicenseTheory", true )
    65. addEventHandler ( "startDrivingLicenseTheory", getRootElement(), startDrivingLicenseTheory_func )
    66. function showDrivingLicenseQuestion ( questionNR )
    67. drivingSchoolCurQuestion = questionNR
    68. gWindow["drivingLicenseTheory"] = guiCreateWindow(screenwidth/2-372/2,screenheight/2-238/2,372,238,"Fuehrerscheinpruefung",false)
    69. guiSetAlpha(gWindow["drivingLicenseTheory"],1)
    70. gLabel["drivingLicenseTheoryQuestion"] = guiCreateLabel(14,48,347,83,drivingLicenses["question"][questionNR],false,gWindow["drivingLicenseTheory"])
    71. guiSetAlpha(gLabel["drivingLicenseTheoryQuestion"],1)
    72. guiLabelSetColor(gLabel["drivingLicenseTheoryQuestion"],255,255,255)
    73. guiLabelSetVerticalAlign(gLabel["drivingLicenseTheoryQuestion"],"top")
    74. guiLabelSetHorizontalAlign(gLabel["drivingLicenseTheoryQuestion"],"left",true)
    75. guiSetFont(gLabel["drivingLicenseTheoryQuestion"],"default-bold-small")
    76. gLabel["drivingLicenseTheoryQuestionNR"] = guiCreateLabel(0,21,370,19,"Frage "..questionNR.." / 7",false,gWindow["drivingLicenseTheory"])
    77. guiSetAlpha(gLabel["drivingLicenseTheoryQuestionNR"],1)
    78. guiLabelSetColor(gLabel["drivingLicenseTheoryQuestionNR"],200,200,0)
    79. guiLabelSetVerticalAlign(gLabel["drivingLicenseTheoryQuestionNR"],"center")
    80. guiLabelSetHorizontalAlign(gLabel["drivingLicenseTheoryQuestionNR"],"center",false)
    81. guiSetFont(gLabel["drivingLicenseTheoryQuestionNR"],"default-bold-small")
    82. gButton["drivingLicenseTheorySend"] = guiCreateButton(372/2-80/2,190,80,38,"Absenden",false,gWindow["drivingLicenseTheory"])
    83. guiSetAlpha(gButton["drivingLicenseTheorySend"],1)
    84. guiSetFont(gButton["drivingLicenseTheorySend"],"default-bold-small")
    85. gRadio["drivingShoolAnswereA"] = guiCreateRadioButton(18,138-10,200,35,drivingLicenses["answereA"][questionNR],false,gWindow["drivingLicenseTheory"])
    86. guiSetAlpha(gRadio["drivingShoolAnswereA"],1)
    87. guiSetFont(gRadio["drivingShoolAnswereA"],"default-bold-small")
    88. gRadio["drivingShoolAnswereB"] = guiCreateRadioButton(191,138-10,200,35,drivingLicenses["answereB"][questionNR],false,gWindow["drivingLicenseTheory"])
    89. guiSetAlpha(gRadio["drivingShoolAnswereB"],1)
    90. guiSetFont(gRadio["drivingShoolAnswereB"],"default-bold-small")
    91. gRadio["drivingShoolAnswereC"] = guiCreateRadioButton(18,163-10,200,35,drivingLicenses["answereC"][questionNR],false,gWindow["drivingLicenseTheory"])
    92. guiSetAlpha(gRadio["drivingShoolAnswereC"],1)
    93. guiSetFont(gRadio["drivingShoolAnswereC"],"default-bold-small")
    94. gRadio["drivingShoolAnswereD"] = guiCreateRadioButton(191,163-10,200,35,drivingLicenses["answereD"][questionNR],false,gWindow["drivingLicenseTheory"])
    95. guiSetAlpha(gRadio["drivingShoolAnswereD"],1)
    96. guiSetFont(gRadio["drivingShoolAnswereD"],"default-bold-small")
    97. addEventHandler ( "onClientGUIClick", gButton["drivingLicenseTheorySend"],
    98. function ()
    99. local selected
    100. if guiRadioButtonGetSelected ( gRadio["drivingShoolAnswereA"] ) then
    101. selected = 1
    102. elseif guiRadioButtonGetSelected ( gRadio["drivingShoolAnswereB"] ) then
    103. selected = 2
    104. elseif guiRadioButtonGetSelected ( gRadio["drivingShoolAnswereC"] ) then
    105. selected = 3
    106. elseif guiRadioButtonGetSelected ( gRadio["drivingShoolAnswereD"] ) then
    107. selected = 4
    108. else
    109. selected = 5
    110. end
    111. destroyElement ( gWindow["drivingLicenseTheory"] )
    112. if drivingLicenses["correct"][drivingSchoolCurQuestion] == selected then
    113. drivingSchoolCorrectQuestions = drivingSchoolCorrectQuestions + 1
    114. end
    115. if drivingSchoolCurQuestion < 7 then
    116. showDrivingLicenseQuestion ( drivingSchoolCurQuestion + 1 )
    117. else
    118. triggerServerEvent ( "drivingSchoolTheoryComplete", lp, drivingSchoolCorrectQuestions )
    119. end
    120. end,
    121. false )
    122. end
    123. function drivingSchoolFinished_func ()
    124. showCursor ( false )
    125. setElementClicked ( false )
    126. end
    127. addEvent ( "drivingSchoolFinished", true )
    128. addEventHandler ( "drivingSchoolFinished", getRootElement(), drivingSchoolFinished_func )
    129. local function checkDrivingSpeed ( )
    130. local veh = getPedOccupiedVehicle ( lp )
    131. if veh and vioClientGetElementData ( "drivingSchoolPractise" ) then
    132. local vx, vy, vz = getElementVelocity ( veh )
    133. local speed = math.sqrt ( vx ^ 2 + vy ^ 2 + vz ^ 2 )
    134. if speed > 130 * 0.00464 then
    135. triggerServerEvent ( "drivingSchoolToFast", lp )
    136. removeEventHandler ( "onClientRender", root, checkDrivingSpeed )
    137. outputDebugString ( "c1" )
    138. end
    139. else
    140. removeEventHandler ( "onClientRender", root, checkDrivingSpeed )
    141. end
    142. end
    143. function checkDrivingSchoolSpeed_func ()
    144. addEventHandler ( "onClientRender", root, checkDrivingSpeed )
    145. end
    146. addEvent ( "checkDrivingSchoolSpeed", true )
    147. addEventHandler ( "checkDrivingSchoolSpeed", getRootElement(), checkDrivingSchoolSpeed_func )
    Alles anzeigen



    Spoiler anzeigen

    Quellcode

    1. drivingSchoolMarkers = {
    2. ["x"] = {
    3. [1]=-2001.8179931641,
    4. [2]=-1712.5074462891,
    5. [3]=-1560.3911132813,
    6. [4]=-1747.5130615234,
    7. [5]=-1990.8626708984
    8. },
    9. ["y"] = {
    10. [1]=603.61480712891,
    11. [2]=731.6,
    12. [3]=731.6,
    13. [4]=307.04,
    14. [5]=137.94
    15. },
    16. ["z"] = {
    17. [1]=35.00,
    18. [2]=25,
    19. [3]=7,
    20. [4]=7,
    21. [5]=33
    22. }
    23. }
    24. function startDrivingSchoolTheory_func ()
    25. local player = client
    26. setElementDimension ( player, tonumber ( vioGetElementData ( player, "playerid" ) ) )
    27. setElementPosition ( player, 361.36, 171.82, 1025.44 )
    28. setPedRotation ( player, 180 )
    29. triggerClientEvent ( player, "startDrivingLicenseTheory", player )
    30. showCursor ( player, true )
    31. setElementClicked ( player, true )
    32. end
    33. function showNextDrivingSchoolMarker ( player )
    34. if vioGetElementData ( player, "drivingSchoolPractise" ) then
    35. local old = vioGetElementData ( player, "drivingSchoolMarker" )
    36. if old then
    37. if isElement ( old ) then
    38. destroyElement ( old )
    39. destroyElement ( vioGetElementData ( player, "drivingSchoolBlip" ) )
    40. end
    41. end
    42. local new = vioGetElementData ( player, "drivingSchoolCur" ) + 1
    43. vioSetElementData ( player, "drivingSchoolCur", new )
    44. if new <= table.size ( drivingSchoolMarkers["x"] ) then
    45. local x, y, z = drivingSchoolMarkers["x"][new], drivingSchoolMarkers["y"][new], drivingSchoolMarkers["z"][new]
    46. local marker = createMarker ( x, y, z, "checkpoint", 10, 200,0,0, 255, player )
    47. local blip = createBlip ( x, y, z, 0, 2, 255, 0, 0, 255, 0, 99999.0, player )
    48. local dim = getElementDimension ( player )
    49. vioSetElementData ( player, "drivingSchoolMarker", marker )
    50. vioSetElementData ( player, "drivingSchoolBlip", blip )
    51. setElementDimension ( marker, dim )
    52. setElementDimension ( blip, dim )
    53. infobox ( player, "Checkpoint erreicht -\nnun zum nächsten!", 5000, 125, 0, 0 )
    54. addEventHandler ( "onMarkerHit", marker, showNextDrivingSchoolMarker )
    55. else
    56. triggerClientEvent ( player, "drivingSchoolFinished", player )
    57. spawnAfterDrivingSchool ( player )
    58. infobox ( player, "Herzlichen\nGlückwunsch,du hast\ndie Fahrprüfung\nbestanden!", 5000, 125, 0, 0 )
    59. vioSetElementData ( player, "carlicense", 1 )
    60. playSoundFrontEnd ( player, 40 )
    61. vioSetElementData ( player, "money", vioGetElementData ( player, "money" ) - vioGetElementData ( player, "drivingLicensePrice" ) )
    62. dbExec ( handler, "UPDATE ?? SET ??=? WHERE ??=?", "userdata", "Autofuehrerschein", 1, "UID", playerUID[getPlayerName ( player )] )
    63. end
    64. end
    65. end
    66. function drivingSchoolTheoryComplete_func ( correct )
    67. local player = client
    68. if correct >= 6 then
    69. -- Practise
    70. showCursor ( player, false )
    71. setElementClicked ( player, false )
    72. setElementInterior ( player, 0 )
    73. local dim = getElementDimension ( player )
    74. local veh = createVehicle ( 421, -1995.3588867188, 171.2080078125, 27.6875 )
    75. local ped = createPed ( 17, 0, 0, 0 )
    76. warpPedIntoVehicle ( player, veh, 0 )
    77. warpPedIntoVehicle ( ped, veh, 1 )
    78. setVehicleDamageProof ( veh, true )
    79. setElementDimension ( veh, dim )
    80. setElementDimension ( ped, dim )
    81. vioSetElementData ( player, "drivingSchoolVeh", veh )
    82. vioSetElementData ( player, "drivingSchoolPed", ped )
    83. vioSetElementData ( player, "drivingSchoolCur", 0 )
    84. vioSetElementData ( player, "drivingSchoolPractise", true )
    85. toggleControl ( player, "enter_exit", false )
    86. outputChatBox ( "Um die praktische Prüfung abzuschließen, musst die die vorgegebene Strecke abfahren.", player, 200, 200, 0 )
    87. outputChatBox ( "Beachte dabei jedoch, dass du nicht schneller als 120 km/h fahren darfst - sonst ist die Prüfung gelaufen!", player, 200, 200, 0 )
    88. outputChatBox ( "Drücke X und L, um Licht oder Motor ein- oder aus zu schalten!", player, 200, 200, 0 )
    89. triggerClientEvent ( player, "checkDrivingSchoolSpeed", player )
    90. showNextDrivingSchoolMarker ( player )
    91. addEventHandler ( "onVehicleExit", veh,
    92. function ( player )
    93. infobox ( player, "Du hast das Fahrzeug verlassen!", 5000, 125, 0, 0 )
    94. spawnAfterDrivingSchool ( player )
    95. end
    96. )
    97. removeEventHandler ( "onPlayerQuit", player, drivingSchoolQuit )
    98. addEventHandler ( "onPlayerQuit", player, drivingSchoolQuit )
    99. else
    100. infobox ( player, "Du bist durchgefallen!\nDu hast nur "..correct.." / 7\n Fragen richtig be-\nantwortet.", 5000, 125, 0, 0 )
    101. spawnAfterDrivingSchool ( player )
    102. end
    103. end
    104. addEvent ( "drivingSchoolTheoryComplete", true )
    105. addEventHandler ( "drivingSchoolTheoryComplete", getRootElement(), drivingSchoolTheoryComplete_func )
    106. function drivingSchoolQuit ()
    107. local player = source
    108. if vioGetElementData ( player, "drivingSchoolPractise" ) then
    109. spawnAfterDrivingSchool ( player )
    110. end
    111. end
    112. function drivingSchoolToFast_func ()
    113. if vioGetElementData ( client, "drivingSchoolPractise" ) then
    114. spawnAfterDrivingSchool ( client )
    115. infobox ( client, "Du bist zu\nschnell gefahren!", 5000, 125, 0, 0 )
    116. end
    117. end
    118. addEvent ( "drivingSchoolToFast", true )
    119. addEventHandler ( "drivingSchoolToFast", getRootElement(), drivingSchoolToFast_func )
    120. function spawnAfterDrivingSchool ( player )
    121. if vioGetElementData ( player, "drivingSchoolPractise" ) then
    122. vioSetElementData ( player, "drivingSchoolPractise", false )
    123. local veh = vioGetElementData ( player, "drivingSchoolVeh" )
    124. if veh then
    125. if isElement ( veh ) then
    126. removePedFromVehicle ( player )
    127. destroyElement ( veh )
    128. end
    129. end
    130. local ped = vioGetElementData ( player, "drivingSchoolPed" )
    131. if ped then
    132. if isElement ( ped ) then
    133. destroyElement ( ped )
    134. end
    135. end
    136. local old = vioGetElementData ( player, "drivingSchoolMarker" )
    137. if old then
    138. if isElement ( old ) then
    139. destroyElement ( old )
    140. destroyElement ( vioGetElementData ( player, "drivingSchoolBlip" ) )
    141. end
    142. end
    143. if isElement ( player ) then
    144. setElementInterior ( player, 3 )
    145. toggleControl ( player, "enter_exit", true )
    146. setElementPosition ( player, 364.42 + 5, 173.81, 1008.039 )
    147. setElementDimension ( player, 0 )
    148. setPedRotation ( player, 90 )
    149. setCameraTarget ( player )
    150. setElementDimension ( player, 0 )
    151. triggerClientEvent ( player, "drivingSchoolFinished", player )
    152. end
    153. end
    154. end
    Alles anzeigen

    Black schrieb:

    Och hoffe ihr bekommt mal ein Blitz ins Auge

    Es gibt Leute, die geizen mit ihrem Verstand wie andere mit ihrem Geld

    Mein Ultimate Edit: github.com/n0pe97/Ultimate-Edit

    Mein GitHub: GitHub
    Discord: n0pe#3317
    Teamspeak: Visual-Life