Jump to content

koragg

Members
  • Posts

    730
  • Joined

  • Last visited

  • Days Won

    2

Posts posted by koragg

  1. 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.

  2. 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. 

  3. 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 :D Are there any errors in debugscript 3 ?

  4. 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 xD

    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. 

  5. 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.

  6. 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. 

  7. Well some functions can only be used on either client-side or server-side but in your particular situation it simply means that if used client-side the position will be changed only to you, meaning that other players will not see the change. Whereas if used server-side all other players will see you in your new position.

    • Like 1
  8. Hey there, I recently renamed all default resources (mapmanager, mapcycler, votemanager, admin, etc) so that they don't get overwritten by other versions when people join other servers than mine. This means that people would download lesser resources when they come from another server to mine. And it all worked fine except for one (for now) resource - scoreboard.zip.

    So The problem in it is that I use the web http interface to see the scoreboard from my site and when I rename the resource to "cr_scoreboard.zip" the website support breaks. Does anyone know what and where I have to edit other than the name so that I can successfully rename the scoreboard resource but retain all it's web functionality? The same applies to the 'resourcebrowser' and the rest web-based resources. Any help would be appreciated. I tried to edit some javascript files inside the scoreboard and other web resources but still couldn't get it to work.

    My goal is to rename every single resource so that when players download them once, they will never need to download them again unless I update the resources themselves.

  9. Just now, MadnessReloaded said:

    Seen no errors at first glance, but I tried the script in a local server anyway just to be sure and it works just fine.

     

     

    The trees are removed? How?!? I tried it at my server as well and they were still there.

    2 minutes ago, ShayF said:

    You can use this, this only works so long as the script is running. There's no way to permanently remove the trees, but what you could do is put this in a script and put the script in auto launch in the mta server config.

    
    local trees = {881,882,883,884,885,889,891}
    
    addEventHandler('onResourceStart',resourceRoot,function()
    	for i=1,#trees do
    		removeWorldModel(trees[i],10000,0,0,0,0)
    		removeWorldModel(trees[i],10000,0,0,0,13)
    	end
    end)
    


     

    Isn't this the same as what I've done but just done in another 'for' loop way? And yes, by permanently I meant as long as the script is running :)

  10. Hey guys, I want to remove the breakable trees mainly found at Back'O'Beyond's forests. I tried this code but they don't get removed, but when I output their IDs in the loop they do show up in chatbox and there're no errors in debug. Any idea how to permanently remove those small and annoying random trees? Server-side:

    local trees = {
    	[881] = true,
    	[882] = true,
    	[883] = true,
    	[884] = true,
    	[885] = true,
    	[889] = true,
    	[891] = true,
    }
    -------------------------------------------------------------------------------------------------------------------------
    function onResourceStart()
    	for key, value in pairs(trees) do
    		removeWorldModel(key, 10000, 0, 0, 0, 0)
    		removeWorldModel(key, 10000, 0, 0, 0, 13)
    	end
    end
    addEventHandler("onResourceStart", resourceRoot, onResourceStart)

     

  11. 1 hour ago, ÆBKV said:
    
    string.find(string.upper(getVehicleNameFromModel(v[1])),string.upper(guiGetText(v_editbox)))
    

    But why is it the same with string.upper?

    Well it won't matter which one you use to be honest. Important thing is that both the vehicle name and the inputted text are the same case. Lowercase or uppercase, your choice.

  12. Maybe you can use this: https://wiki.multitheftauto.com/wiki/GetVehiclePlateText

    and if a vehicle with the plate you write is found, show all of the things of that vehicle (idk what you want to show). So something like:

    function checkPlate(player, command, text)
    	for k, v in ipairs(getElementsByType("vehicle")) do
    		if string.lower(getVehiclePlateText(v)) == string.lower(text) then
    			outputChatBox("Yey, it worked! Let's output some :~", player, 255, 255, 255, true)
    		else
    			outputChatBox("fml.", player, 255, 255, 255, true)
    		end
    	end
    end
    addCommandHandler("checkplate", checkPlate)

    Obviously not tested xD

    • Thanks 1
×
×
  • Create New...