OGPrettyMF Posted August 15, 2016 Share Posted August 15, 2016 Hello! Hi,I just edited the script "driver licence".But I have a problem... When I appear on the last marker , the script doesn`t give out the message in a chat " Congratulations ! You've got a driver's license ! Observe traffic rules!" (in Russian"Поздравляю!Вы сдали на права!Соблюдайте ПДД!") But it is written in the script. function chek (elem) --if getElementType ( elem ) == "vehicle" then --local driver = getVehicleOccupant ( elem ) local driver = elem if elem == localPlayer then local markelem = getElementData ( driver, "drivingMarker" ) local markid = getElementData ( driver, "drivingMarkerID" ) if isElement ( markelem ) and markelem == source and markid then if markid == #markersPos then triggerServerEvent ( 'finishExmanigAuto', localPlayer ) destroyElement (source) outputChatBox ( "Поздравляю!Вы сдали на права!Соблюдайте ПДД", driver, 0, 255, 0, true ) setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) elseif markid < #markersPos then setElementData ( driver, "drivingMarkerID", markid + 1 ) setElementPosition ( markelem, markersPos[markid+1][1],markersPos[markid+1][2],markersPos[markid+1][3]) end else setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) end end end Help me fix this error! scripts: -client: function loadLicResource () licPickupSF = createPickup ( 629.409, -571.822, 16.74, 3, 1274 ) createBlip ( 613.756, -596.632, 16.750, 36, 2, 255, 0, 0, 255, 0, 200 ) addEventHandler( "onClientPickupHit", licPickupLS, buyLicenseHit ) addEventHandler( "onClientPickupHit", licPickupSF, buyLicenseHit ) end addEventHandler ( "onClientResourceStart", getResourceRootElement(getThisResource()), loadLicResource ) function buyLicenseHit ( thePlayer, matchingDimension ) if thePlayer == localPlayer then showLicenseBuy () end end function showLicenseBuy () licenseWindow = guiCreateWindow(0.36, 0.36, 0.19, 0.46, "", true) guiWindowSetSizable(licenseWindow, false) guiSetAlpha(licenseWindow, 1.00) vehicleLabel = guiCreateLabel(0.15, 0.08, 1, 0.05, "Лицензия на вождение авто", true, licenseWindow) --guiLabelSetHorizontalAlign(vehicleLabel, "center", false) vehicleRight = guiCreateButton(0.23, 0.13, 0.52, 0.12, "Сдать на права", true, licenseWindow) aeroLabel = guiCreateLabel(0.34, 0.25, 1, 0.05, "или купить за:", true, licenseWindow) vehicleButton = guiCreateButton(0.23, 0.30, 0.52, 0.12, "10000$", true, licenseWindow) if getElementData ( localPlayer, "carLicense" ) then guiSetEnabled ( vehicleButton, false ) guiSetText (vehicleButton, "Куплена") end guiSetProperty(boatButton, "NormalTextColour", "FFAAAAAA") closeButton = guiCreateButton(0.28, 0.91, 0.45, 0.08, "Закрыть", true, licenseWindow) guiSetProperty(closeButton, "NormalTextColour", "FFAAAAAA") guiSetVisible ( licenseWindow, true ) showCursor ( true ) addEventHandler("onClientGUIClick", vehicleButton, function () if getPlayerMoney () >= 10000 then guiSetEnabled ( vehicleButton, false ) guiSetText (vehicleButton, "Куплена") triggerServerEvent ( "givePlayerLicenseClient", localPlayer, 1 ) else outputChatBox ( "У Вас недостаточно денег!", 255, 150, 100 ) end end,false) addEventHandler("onClientGUIClick", vehicleRight, function () triggerServerEvent ( "markers", getLocalPlayer()) end,false) addEventHandler("onClientGUIClick", closeButton, function () showCursor ( false ) guiSetVisible ( licenseWindow, false ) destroyElement ( licenseWindow ) end,false) end --addEventHeandler ("onClientRender", getRootElement(), showLicenseBuy) function showLicensesC ( name, car, aero, boat) licenseWindow = guiCreateWindow(0.36, 0.36, 0.20, 0.20, "Лицензии игрока "..name, true) guiWindowSetSizable(licenseWindow, false) guiSetAlpha(licenseWindow, 1.00) carLic = "нету" if car then carLic = "есть" end vehicleLabel = guiCreateLabel(0.06, 0.17, 1, 0.11, "Лицензия на вождение авто: "..carLic, true, licenseWindow) closeButton = guiCreateButton(0.29, 0.68, 0.43, 0.18, "Закрыть", true, licenseWindow) guiSetProperty(closeButton, "NormalTextColour", "FFAAAAAA") addEventHandler("onClientGUIClick", closeButton, function () showCursor ( false ) guiSetVisible ( licenseWindow, false ) destroyElement ( licenseWindow ) end,false) end addEvent( "showLicenses", true ) addEventHandler( "showLicenses", getRootElement(), showLicensesC ) addEvent( "knopka", true ) function show () guiSetEnabled ( vehicleRight, false ) guiSetText (vehicleRight, "Получены") end addEventHandler( "knopka", getRootElement(), show ) markersPos = { { 667.0592,-602.50,15.703 }, { 720.624,-597.272,15.704 }, { 719.1107,-485.990,15.7042 }, { 679.4385,-497.175,15.70 }, { 606.470,-526.091,15.70 }, { 606.6531,-488.603,15.70}, { 716.450,-489.529,15.70 }, { 718.2867,-595.080,15.70 }, { 677.824,-656.424,15.70 }, { 641.2035,-652.035,15.70 }, { 627.403, -601.862, 16.13 }, } function startExamingC () mark = createMarker ( 667.0592,-602.50,15.703, "checkpoint", 2.5, 255, 0, 0, 180 ) setElementData ( source, "drivingMarker", mark ) setElementData ( source, "drivingMarkerID", 1 ) addEventHandler("onClientMarkerHit", mark, chek) end addEvent( "startExaming", true ) addEventHandler( "startExaming", getRootElement(), startExamingC ) function chek (elem) --if getElementType ( elem ) == "vehicle" then --local driver = getVehicleOccupant ( elem ) local driver = elem if elem == localPlayer then local markelem = getElementData ( driver, "drivingMarker" ) local markid = getElementData ( driver, "drivingMarkerID" ) if isElement ( markelem ) and markelem == source and markid then if markid == #markersPos then triggerServerEvent ( 'finishExmanigAuto', localPlayer ) destroyElement (source) outputChatBox ( "Поздравляю!Вы сдали на права!Соблюдайте ПДД", driver, 0, 255, 0, true ) setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) elseif markid < #markersPos then setElementData ( driver, "drivingMarkerID", markid + 1 ) setElementPosition ( markelem, markersPos[markid+1][1],markersPos[markid+1][2],markersPos[markid+1][3]) end else setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) end end end -server: addEventHandler("onPlayerLogin", root, function( thePreviousAccount, theCurrentAccount, autoLogin ) if getAccountData ( theCurrentAccount, "carLicense" ) then setElementData ( source, "carLicense", true) end end ) addEvent( "givePlayerLicenseClient", true ) addEventHandler( "givePlayerLicenseClient", getRootElement(), givePlayerLicense ) noNeedModels = { 448, 510, 462, 509, 481 } -- модели авто, которым не нужны права function isVehicleNoNeed (model) for i, v in ipairs ( noNeedModels ) do if v == model then return true end end return false end function enterVehicle ( thePlayer, seat, jacked ) if seat == 0 then if ( not getElementData ( thePlayer, "carLicense" ) and not isVehicleNoNeed ( getElementModel ( source )) ) then outputChatBox ( "У вас нет лицензии на вождение автомобиля.", thePlayer, 255, 100, 100 ) setControlState ( thePlayer, "enter_exit", true ) end end end addEventHandler ( "onVehicleEnter", getRootElement(), enterVehicle ) function showLicToPlayer ( player, cmd, name ) if name then local target = getPlayerFromName ( name ) if target then outputChatBox ( "Вы показали свои лицензии игроку "..getPlayerName ( target ), player, 50, 255, 50 ) outputChatBox ( getPlayerName ( player ).." показал вам свои лицензии", target, 50, 255, 50 ) triggerClientEvent ( target, "showLicenses", target, getPlayerName ( player ), getElementData ( player, "carLicense" ), getElementData ( player, "aeroLicense" ), getElementData ( player, "boatLicense" ) ) else outputChatBox ( "Игрок не найден", player, 255, 150, 140 ) end else triggerClientEvent ( player, "showLicenses", player, getPlayerName ( player ), getElementData ( player, "carLicense" ), getElementData ( player, "aeroLicense" ), getElementData ( player, "boatLicense" ) ) end end markersPos = { { 667.0592,-602.50,15.703 }, { 720.624,-597.272,15.704 }, { 719.1107,-485.990,15.7042 }, { 679.4385,-497.175,15.70 }, { 606.470,-526.091,15.70 }, { 606.6531,-488.603,15.70}, { 716.450,-489.529,15.70 }, { 718.2867,-595.080,15.70 }, { 677.824,-656.424,15.70 }, { 641.2035,-652.035,15.70 }, { 627.403, -601.862, 16.13 }, } addCommandHandler ("showlic", showLicToPlayer ) addEvent( "markers", true ) addCommandHandler ("showlic", showLicToPlayer ) addEvent( "markers", true ) function auto ( ) if getElementData ( source, "carLicense" ) then outputChatBox ( "Вы уже сдали на права!", source, 200, 0, 0, true ) else vedro = createVehicle ( 506, 613.756, -596.632, 16.750, 36 ,0,0,0 ) acc = getPlayerAccount ( source ) setAccountData ( acc, "carLicense", "1" ) setElementData ( source, "carLicense", true) warpPedIntoVehicle ( source, vedro ) function killt(thePlayer) theVehicle = getPedOccupiedVehicle ( thePlayer ) id = getElementModel ( theVehicle ) if id == 506 then account = getPlayerAccount ( thePlayer ) setAccountData ( acc, "carLicense", "0" ) setElementData ( thePlayer, "carLicense", false) outputChatBox ( "Вы закончили занятие в автошколе!", thePlayer, 255, 0, 0, true ) veh = getPedOccupiedVehicle ( thePlayer ) destroyElement (veh) end end addEventHandler ( "onVehicleStartExit", getRootElement(), killt ) triggerClientEvent ( source, "startExaming", source ) end end addEventHandler( "markers", getRootElement(), auto ) function chek (elem) if getElementType ( elem ) == "vehicle" then local driver = getVehicleOccupant ( elem ) if driver then local markelem = getElementData ( driver, "drivingMarker" ) local markid = getElementData ( driver, "drivingMarkerID" ) if isElement ( markelem ) and markelem == source and markid then if markid == #markersPos then destroyElement (source) ac = getPlayerAccount ( driver ) setAccountData ( ac, "carLicense", "1" ) setElementData ( driver, "carLicense", true) destroyElement (elem) outputChatBox ( "Вы сдали на права!", driver, 0, 255, 0, true ) setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) elseif markid < #markersPos then setElementData ( driver, "drivingMarkerID", markid + 1 ) setElementPosition ( markelem, markersPos[markid+1][1],markersPos[markid+1][2],markersPos[markid+1][3]) end else setElementData ( driver, "drivingMarker", false ) setElementData ( driver, "drivingMarkerID", false ) end end end end function finishExmanigAutoS () local veh = getPedOccupiedVehicle ( source ) if isElement ( veh ) then destroyElement ( veh ) ac = getPlayerAccount ( source ) setAccountData ( ac, "carLicense", "1" ) setElementData ( source, "carLicense", true) end end addEvent( "finishExmanigAuto", true ) addEventHandler( "finishExmanigAuto", getRootElement(), finishExmanigAutoS ) Link to comment
Gravestone Posted August 15, 2016 Share Posted August 15, 2016 Which function is this event handling? addEventHandler( "givePlayerLicenseClient", getRootElement(), givePlayerLicense ) Link to comment
OGPrettyMF Posted August 15, 2016 Author Share Posted August 15, 2016 Which function is this event handling? addEventHandler( "givePlayerLicenseClient", getRootElement(), givePlayerLicense ) Yes,maybe yes.I am bad at lua Link to comment
Gravestone Posted August 15, 2016 Share Posted August 15, 2016 Neither on client side nor on server side is a function with "givePlayerLicense" name. Link to comment
OGPrettyMF Posted August 15, 2016 Author Share Posted August 15, 2016 Which function is this event handling? addEventHandler( "givePlayerLicenseClient", getRootElement(), givePlayerLicense ) Yes,maybe yes.I am bad at lua oh...Sorry.I don`t know.it`s not my script Link to comment
Gravestone Posted August 15, 2016 Share Posted August 15, 2016 Then you have to contact the owner of the script. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now