wondersnofna Posted January 5, 2018 Share Posted January 5, 2018 hey, i am trying to make a race server. its going pretty good. but i play with my brother. so (2 people) and if one dies.. the game will end and it will select a new map. how can i make it so the game only ends when the hunter is reached? thanks! Link to comment
Doffy Posted January 5, 2018 Share Posted January 5, 2018 (edited) use var = 0 "onResourceStart" getElementType createVehicle setTimer if var == 0 then killPed cancelEvent outputChatBox Edited January 5, 2018 by #Himoo Link to comment
wondersnofna Posted January 5, 2018 Author Share Posted January 5, 2018 where should i put that in? sorry im new to this Link to comment
wondersnofna Posted January 5, 2018 Author Share Posted January 5, 2018 mta san andreas 1.5 > server > mods > deathmatch? which map is it in? 1 Link to comment
koragg Posted January 5, 2018 Share Posted January 5, 2018 What you're doing is definitely not a race server, it's a DM one. Never confuse the two. And seeing you are searching for a map in which to put the functions given to you I'd suggest to hold back with opening your server or even making big things. Download community resources, edit them, fix errors, recreate them, make your own small mods, etc. You need to learn the basics before doing anything at all. Link to comment
wondersnofna Posted January 5, 2018 Author Share Posted January 5, 2018 yeah i meant dm racing. sorry. its just a server i play on with my brother. he likes oldschool things. the new maps that come out are way to hard for him. thats why i try to make a server for him. im just getting into it. and i cant find the file i need to edit to make the game end when the hunter is reached. Link to comment
koragg Posted January 5, 2018 Share Posted January 5, 2018 Can't test but try to open "race.zip", then open the file called "race_server.lua" and find the function called "raceTimeout". Now above the function add this addEvent("timesUpPalServer", true) and right after the function ends add this addEventHandler("timesUpPalServer", root, raceTimeout) Now at the very end of the same file (can be anywhere, just to be easily findable I say this) put this function onPlayerPickUpRacePickup(pickupID, pickupType, vehicleModel) if pickupType == "vehiclechange" then if vehicleModel == 425 then triggerServerEvent("timesUpPalServer", localPlayer) end end end addEventHandler("onPlayerPickUpRacePickup", root, onPlayerPickUpRacePickup) Save the "race_server.lua", save/update the "race.zip" and restart it using /restart race command in server. Now when a player picks up a "vehiclechange" pickup and if the vehicle it changes to is with ID 425 (aka Hunter) it forces the "Time's up pal!" message and the map ends. Link to comment
wondersnofna Posted January 5, 2018 Author Share Posted January 5, 2018 sorry for being a noob.. but i get your code. but for some reason addEvent and addEventhandler wont turn blue. and the script doesnt work. do you know what causes it? Link to comment
koragg Posted January 6, 2018 Share Posted January 6, 2018 (edited) 10 hours ago, wondersnofna said: sorry for being a noob.. but i get your code. but for some reason addEvent and addEventhandler wont turn blue. and the script doesnt work. do you know what causes it? Yes it was beyond midnight so i made a mistake Replace triggerServerEvent with triggerEvent and see then. If still nothing replace localPlayer with root inside the event call. About the blue there's no problem. It should be blue if you're using Notepad++ but maybe you're using another program. Oh and use /debugscript 3 in chat when you test stuff. It gives you what's wrong and can help you (us) in fixing the problem much easier. You can turn off debug with /debugscript 0 when you're done with it. Edited January 6, 2018 by koragg Link to comment
wondersnofna Posted January 6, 2018 Author Share Posted January 6, 2018 hello, i am using notepad++ but it still wont turn blue. i found other addEvent's and they werent blue either so dunno if its fine. and i cant get the code to work sorry for bothering you. Link to comment
koragg Posted January 6, 2018 Share Posted January 6, 2018 (edited) 44 minutes ago, wondersnofna said: hello, i am using notepad++ but it still wont turn blue. i found other addEvent's and they werent blue either so dunno if its fine. and i cant get the code to work sorry for bothering you. OK, forget about the blue Are there any errors in debugscript 3 ? Edited January 6, 2018 by koragg Link to comment
wondersnofna Posted January 6, 2018 Author Share Posted January 6, 2018 im not getting any errors in the console. is there a way i could send you the file Link to comment
koragg Posted January 6, 2018 Share Posted January 6, 2018 4 hours ago, wondersnofna said: im not getting any errors in the console. is there a way i could send you the file Even if you send it i can't test it as i don't have mta installed atm. Should work, by console i hope you mean the /debugscript 3 window as F8 won't show any errors. Link to comment
wondersnofna Posted January 6, 2018 Author Share Posted January 6, 2018 it says one dm map is missing music. and the login panel has some weird error. but there is nothing wrong with race lua Link to comment
koragg Posted January 6, 2018 Share Posted January 6, 2018 OK then, new approach. Remove the code you put at the end of the file and put this instead: function onResStart() setTimer(function() for i, player in ipairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(player) if veh then if getElementModel(veh) == 425 then triggerEvent("timesUpPalServer", root) end end end end, 50, 0) end addEventHandler("onResourceStart", resourceRoot, onResStart) When the race resource starts an infinite timer will be started which checks if a player's vehicle is with ID 425 (Hunter) every 50 milliseconds and if it is - ends the race. 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