Jump to content

LoPollo

Members
  • Posts

    353
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by LoPollo

  1. LoPollo

    mute

    triggerServerEvent ( "UnAFK", localPlayer ) -> addEvent('GoToAFK', true) + addEventHandler('GoToAFK' wtf??? setPlayerMuted???? nope: see here, i think you wanted that PS: about the handler, do not trusts clients: --replace function(player ) exports.voice:setPlayerChannel ( player , 6 ) --with function( ) player = client exports.voice:setPlayerChannel ( player , 6 ) player was not the client localplayer, which was the source: player was nil. also do not use source, use client: it's the predefined variable that contains the player that triggered the event
  2. But this means making a huge script just for that. What cody said is a possibility, but is it really worth it? The idea gravestone mentioned is partly correct: i'm not a shader expert, but i guess you can only add details to a vehicle, the model will still be the same (i mean shaders changes textures) The idea simple01 had is also nice, but it still limited to the ids, so we are still replacing. (PS: it also needs a lot of work) I mean that there are workarounds, but it definitely not worth the madness needed to do it. We know adding things without replacing is a great thing, just search on google or whatever how many times this idea is reported, but now simply isn't worth the work needed. Once the limiter gets implemented we won't have these limits and these problems (if it gets implemented lol).
  3. cancelling the damage will still make the players take the force of an explosion etc... i think it's better toggling the controls. It's better to prevent. What do you mean? A resource that makes ONLY ammu-nations, shops and restaurants enterable? i think you need to edit the default resource "interiors" map, i'm not aware of any resource that opens ALL the above places without making houses and apartaments accessible....
  4. are you using the default interiors resource? it provides some events useful for you. when entering an interior: save the weapons the player has, then take them so he won't have any weapon while in interior. when exiting: give the saved weapons Another solution is to prevent any client from shooting while in an interior (overworld interior is 0, keep in mind dimensions, but these depends on what you want to do and what the server already has)
  5. That's because players get spawned before the match starts i guess... So if there's a state that define when the match is ongoing and when not i should use it, so i must pass the states on the client. Again, this is untested. I made state handling clientside, so client now knows what state is currently active. To fix the issue you said i made the startText return and not perform any further action if the current state is not true. So when you spawn but the match is not ongoing the text won't be drawn. Again, all the states table is filled with nils*, cause i have no exact idea of when each state becomes active ( i do not play race ), so edit it if it's needed. When that state becomes the current state: nil -> no action true -> the text will be shown (call startText) false -> the text will be hidden (call stopText) * i set Running as true because this is the state i think means the match is ongoing --client local sX,sY = guiGetScreenSize() local counter = 15 local r,g,b = 0,255,0 local counterTimer local isTextShowing --alternative to todo function "isEventHandled" --set the states to nil to not perform any action when that state becomes the current state, true to show text, false to hide text local states = { ["undefined"] = nil, ["NoMap"] = nil, ["LoadingMap"] = nil, ["PreGridCountdown"] = nil, ["GridCountdown"] = nil, ["Running"] = true, ["MidMapVote"] = nil, ["SomeoneWon"] = nil, ["TimesUp"] = nil, ["EveryoneFinished"] = nil, ["PostFinish"] = nil, ["NextMapSelect"] = nil, ["NextMapVote"] = nil, ["ResourceStopping"] = nil, } addEvent( "onServerRaceStateChangingNotice", true ) function drawCounterSHI() dxDrawText( "Your vehicle will change in: "..counter, 0, sY*0.8, sX,sY, tocolor(r,g,b,255), 2, "default", "center", "top", false, false, false ) end function startEverything() startText() --start the timer and make the text visible end addEvent( "onCounterStart", true) addEventHandler( "onCounterStart", root, startEverything ) function stopText() --stop the timer, it's useless now if isTimer( counterTimer ) then killTimer(counterTimer) end --make the text not visible if isTextShowing then removeEventHandler( "onClientRender", root, drawCounterSHI ) isTextShowing = false end end addEventHandler( "onClientPlayerWasted", localPlayer, stopText ) function startText() if states.currentState ~= "Running" then return end --i guess that is the state that means the match is ongoing if isTimer( counterTimer ) then killTimer( counterTimer ) end --set the counter to 15s counter = 15 --start the timer again counterTimer = setTimer( function() counter = counter - 1 if counter < 1 then counter = 15 r,g,b = 0,255,0 end end, 1000, 0 ) --make the text visible if not isTextShowing then addEventHandler( "onClientRender", root, drawCounterSHI ) isTextShowing = true end end addEventHandler( "onClientPlayerSpawn", localPlayer, startText ) function raceStateChangeHandler( newState, oldState ) states.currentState = newState if states[newState] == true then startText() elseif states[newState] == false then stopText() end end addEventHandler( "onServerRaceStateChangingNotice", resourceRoot, raceStateChangeHandler ) --server function makeClientKnowMapChange( newState, oldState ) triggerClientEvent( root, "onServerRaceStateChangingNotice", resourceRoot, newState, oldState ) end addEventHandler( "onRaceStateChanging", root, makeClientKnowMapChange )
  6. ok here's an incomplete UNTESTED example of how i think it can be done* I have no idea on how you want to manage onCounterStart... so i leave this to you unchanged When you die the text disappear When you spawn the text appear When the race state changes, you can make the client text appear/disappear** * I have wrote this in a hurry, i didn't check any syntax error, but i tried to be as clear as possible and i hope you understand the logic. ** ToDo: you must change the values of the table in makeClientKnowMapChange to make the triggers work. I have no idea of the correct values, experiment this yourself, since now i can't test. --client local sX,sY = guiGetScreenSize() local counter = 15 local r,g,b = 0,255,0 local counterTimer local isTextShowing --alternative to todo function "isEventHandled" addEvent( "onServerStopTextRequest", true ) addEvent( "onServerStartTextRequest", true ) function drawCounterSHI() dxDrawText( "Your vehicle will change in: "..counter, 0, sY*0.8, sX,sY, tocolor(r,g,b,255), 2, "default", "center", "top", false, false, false ) end function startEverything() startText() --start the timer and make the text visible end addEvent( "onCounterStart", true) addEventHandler( "onCounterStart", root, startEverything ) function stopText() --stop the timer, it's useless now if isTimer( counterTimer ) then killTimer(counterTimer) end --make the text not visible if isTextShowing then removeEventHandler( "onClientRender", root, drawCounterSHI ) isTextShowing = false end end addEventHandler( "onClientPlayerWasted", localPlayer, stopText ) addEventHandler( "onServerStopTextRequest", resourceRoot, stopText ) function startText() if isTimer( counterTimer ) then killTimer( counterTimer ) end --set the counter to 15s counter = 15 --start the timer again counterTimer = setTimer( function() counter = counter - 1 if counter < 1 then counter = 15 r,g,b = 0,255,0 end end, 1000, 0 ) --make the text visible if not isTextShowing then addEventHandler( "onClientRender", root, drawCounterSHI ) isTextShowing = true end end addEventHandler( "onClientPlayerSpawn", localPlayer, startText ) addEventHandler( "onServerStartTextRequest", resourceRoot, startText ) --server function makeClientKnowMapChange( newState, oldState ) local states = { ["undefined"] = nil, ["NoMap"] = nil, ["LoadingMap"] = nil, ["PreGridCountdown"] = nil, ["GridCountdown"] = nil, ["Running"] = nil, ["MidMapVote"] = nil, ["SomeoneWon"] = nil, ["TimesUp"] = nil, ["EveryoneFinished"] = nil, ["PostFinish"] = nil, ["NextMapSelect"] = nil, ["NextMapVote"] = nil, ["ResourceStopping"] = nil, } if states[newState] == true then triggerClientEvent( root, "onServerStartTextRequest", resourceRoot ) elseif states[newState] == false then triggerClientEvent( root, "onServerStopTextRequest", resourceRoot ) end --ignore nil values end addEventHandler( "onRaceStateChanging", root, makeClientKnowMapChange )
  7. This limit adjuster is not compatible with MTA, but there were plans about implementing it. So as of now the answer to your first question is, as @myonlake said, no. In the future though there's a possibility of this becoming implemented and adding (without the need of replace) things will become reality.
  8. As of now. I'm posting to make sure @Simi23 knows this.
  9. I lost the thread, so can you post the code you have now?
  10. oh ok did you solve the bug that keeps the timer running and the text on screen on map change? also did you fixed the timer when a player die? bug and fix are big words here... that's more completing the code
  11. i don't understant any of your latest replies... can you explain? sorry for this only numbers to do what? to stop/reset/start the timer? isTimer, killTimer, setTimer are enough if that's the answer EDIT: remember to stop/start showing the text, adding or removing the onClientRender handler what do you mean? that from now it will not be easy? I feel dumb
  12. you're right when you say there's a security problem with shared compiled scripts, in fact i don't use them. I was just giving an answer to "Why do they release it when it's compiled ... " Also i agree with "0/5 rating", since the author can be "evil" as i said in my previous reply Remember: (he) don't want to let other know
  13. onRaceStateChanging will be called on race end - map change, i think. Use this to stop and reset the timer and stop drawing the text. Even if this wasn't the answer to you prevoious question, it's a good idea to reset the timer here too, since (i guess) the timer which will make you change vehicle get resetted too (stopped on death, resetted and started on spawn)-
  14. Actually if the resource is highly configurable in the meta and it's "general" (usable in every server) then i think it can be shared even compiled, if the (evil) author don't want to let other know how he did achieve that result. This is what i think at least, everyone is free to have his own opinion
  15. Some files (i've seen script_c and script_s) are encoded (=luac), even if the extension is .lua. You can't edit or customize these files
  16. This is not code lol. Check the errors in the console. There must be errors since there are some undefined variables: draw (it should be a function) timer (it should be a timer) newState (it should be a string?) Before i said this is not code because the if at line 13 is not closed (well, it get closed actually... but this leave open other things) I would sugget to use indentation so you can visually know where there are these kind of errors local sX,sY = guiGetScreenSize() local counter = 15 local r,g,b = 0,255,0 addEvent( "onCounterStart", true ) function drawCounterSHI() dxDrawText("Your vehicle will change in: "..counter,0,sY*0.8,sX,sY,tocolor(r,g,b,255),2,"default","center","top",false,false,false) end function startEverything() addEventHandler( "onClientRender", root, drawCounterSHI ) removeEventHandler("onClientRender", root, draw) --define draw setTimer( --someTimer? function() counter = counter - 1 if counter < 1 then --counter = 15 --??? end--this was missing end, 1000, 0 ) if newState == "LoadingMap" then --define newState. Is it derived from "racestates"??? killTimer(timer) --define timer. Is it the timer "someTimer"? end end addEventHandler( "onCounterStart", root, startEverything ) Can you link? i can't find it
  17. LoPollo

    Vehicle Shot

    If the problem still persists, and i understand right, is it possible that this is due a MTA bug? Wiki reports some issues Issue ID Description #8132 Projectile target only allows player element (and a projectile?) #5072 createProjectile creates one projectile for every person in the vehicle If it's not due a bug, what happens if you temporary set as creator the localPlayer?
  18. LoPollo

    SQLite Problem

    Then the only thing that's left is the table itself. Did you try using a graphical viewer to check if records have the field num as it's supposed to? But since you don't change this field and the first time it's working then we can delete this from the list. Still see if the table has the correct values that you get from the script. Note: It is usually good practice to surround table and column names with backticks (`) in case they contain spaces or SQL keywords (and therefore cause syntax errors). This is especially true when using variables for table and column names, as potential problems may not be apparent when the script is first written. Some vehicle have spaces in their name, and the plate can have spaces too. Other than this i'm out of ideas
  19. LoPollo

    SQLite Problem

    num=? > ? is the variable num with the value of vehs[player]:getData("num") Output/debug that variable and check it isn't returning false.
  20. your "if" checknif aTimer is a timer. You set it as timer in the previous line. also your "or" is probably an else?
  21. I know the code pa3ck it's working, but once the element is found on the second array it's useless continue the loop, except if you want to count the number of elements in arr2 equals to an element in arr1, but the function is not made and still will not work in this case. So isn't it better to insert a "break" between line 11 and 12? Have a nice day
  22. Players are not meant to be used as data storage/database. I don't think that the elemnet tree can be used in this way to get data
  23. Check your code, seriously. Think what every instruction do like if you are the computer. I don't think a real help is needed.
  24. https://wiki.multitheftauto.com/wiki/Slothman/Zombies#StreamMethod edf/zombies.edf i guess
×
×
  • Create New...