-
Posts
1,390 -
Joined
-
Last visited
-
Days Won
1
Everything posted by Et-win
-
Cheez3D, if you don't know how it works, please don't react. Go test your own script which you posted by yourself. I did too, and it posted for everyone. setTimer does NOT have a source. How can you think about outputting it then? setTimer doesn't 'remember' the source+arguments you sended withing the function, that's why you have to put them in the setTimer.
-
setTimer Read the wiki, then you will see that the limit = 50 ms.
-
That is the same thing as what he posted above. No, it is not. setTimer has no 'source' and that is why you have to send the 'source' as a argument.
-
I have no idea then. Or you have the wrong line in the script, or Idk what else. Maybe someone can tell you exactly where to put it/to make it working.
-
Logical, source is not defined. Add it to the timer: setTimer(function(tPlayer) setPedAnimation(tPlayer, false) end, 1000, 1, source)
-
setPedAnimation(source,false) Try to understand the code. (Example number 3)
-
You have to search where the messages get outputted by 'outputChatBox' and add 'true' as last argument. outputChatBox
-
Thanks for the reply everyone, it made me wiser. Actually if I understand (And tested it) right, this only gets called when MTA loses focus. I want to make the text inside this render target moving, which means I have to re-draw the text on every frame. (As soon as the resource starts, the text is moving permanently) So that would mean, can I also put a render on this function? Because I don't see another way to keep editing the positions of the text without render? EDIT: I now have this: sWidth, sHeight = guiGetScreenSize() sW, sH = 105, 32 cFont = dxCreateFont("files/fonts/SegoeWPN_0.ttf", 32, false) gTarget = dxCreateRenderTarget(sW, sH, true) function updateRenderTarget() dxSetRenderTarget(gTarget, true) dxSetBlendMode("modulate_add") dxDrawText("CWS:Home", 0, 0, sW, sH, tocolor(0, 0, 255), 0.5, cFont, "center", "center") dxSetBlendMode("blend") dxSetRenderTarget() dxSetBlendMode("add") dxDrawImage((sWidth/2)-(sW/2), (sHeight/2)-(sH/2), sW, sH, gTarget) dxSetBlendMode("blend") end addEventHandler("onClientRender", root, updateRenderTarget) It works fine, but just want to be sure or it isn't going to cause any problems( later). (I do understand how this works now, but still want to be sure, because it's permanently running. )
-
Already told you that since the start of this topic that it wasn't my script, because I didn't use that events. Then I have to look into your script alot again to see what it's doing... You wanted an example, there is your example (My script). Merge it together/Build it in. Learn what I did, do the same.
-
if getElementModel(getPedOccupiedVehicle(thePlayer)) == 425 then It supports an model ID by 'int', not by string, also check it's model, now you were only checking which vehicle 'data' it was.
-
Mind sharing what kind of backdoor?
-
I was wondering which of this 2 code's is good to use correctly: 1: sWidth, sHeight = guiGetScreenSize() sW, sH = 105, 32 cFont = dxCreateFont("files/fonts/SegoeWPN_0.ttf", 32, false) gTarget = dxCreateRenderTarget(sW, sH, true) function testRender() if (gTarget ~= false) then dxSetRenderTarget(gTarget) dxDrawText("CWS:Home", 0, 0, sW, sH, tocolor(0, 0, 255), 0.5, cFont, "center", "center", true) dxSetRenderTarget() dxDrawImage((sWidth/2)-(sW/2), (sHeight/2)-(sH/2), sW, sH, gTarget) end end addEventHandler("onClientRender", getRootElement(), testRender) Or 2: sWidth, sHeight = guiGetScreenSize() sW, sH = 105, 32 cFont = dxCreateFont("files/fonts/SegoeWPN_0.ttf", 32, false) function testRender() if (gTarget ~= false) then gTarget = dxCreateRenderTarget(sW, sH, true) dxSetRenderTarget(gTarget) dxDrawText("CWS:Home", 0, 0, sW, sH, tocolor(0, 0, 255), 0.5, cFont, "center", "center", true) dxSetRenderTarget() dxDrawImage((sWidth/2)-(sW/2), (sHeight/2)-(sH/2), sW, sH, gTarget) end end addEventHandler("onClientRender", getRootElement(), testRender) It's about the dxCreateRenderTarget code I am using. I'm not sure which one is correct to use. Does it have to be in or out the render function? (I don't know (yet) or this depends on it: But I'm going to move the text in dxCreateRenderTarget)
-
Why are you posting a new topic? And like I said, there could be error's in the script because I typed it out of my head, but still it is for an example. Also, this has totally nothing to do with the error's because this script I made doesn't even use 'friendly', 'time' and 'countdown' as events.
-
Give script, I can't smell what you did wrong in your scripts e.e
-
Use: bindKey("accelerate", function) (As far as I understand out of wiki this should work)
-
Good. Also I advise you to use getElementModel instead of getVehicleID, because getVehicleID is an old function and will maybe not exist in future versions. (Atleast that is what they say at Wiki) EDIT: Search here for codes: https://wiki.multitheftauto.com/wiki/Main_Page (Left side: Server/Client functions/event) Use: bindKey But also note that players can change their driving key to another key. At this moment I don't know how to get this key.
-
function giveSomeoneMoney(player, cmd, target, amount) if target then if amount then local money = getPlayerMoney(player) local targetplayer = getPlayerFromParticalName(target) local r,g,b = getPlayerNametagColor(player) amount = tonumber(amount) if targetplayer then if money >= amount then givePlayerMoney(targetplayer, amount) takePlayerMoney(player, amount) outputChatBox("You have been given #00FF00$"..tostring(amount).." #0096FF from #FFFFFF"..getPlayerName(player) , targetplayer, 0, 81, 255, true) outputChatBox("You gave #00FF00$"..tostring(amount).."#0096FF to #FFFFFF"..getPlayerName(targetplayer), player, 0, 81, 255, true) else outputChatBox("You don't have enought money!", player, 255, 0, 0) end else outputChatBox("Error: Player not found", player, 255, 0, 0) end else outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) end else outputChatBox("Error: /givemoney [player name] [amount]", player, 255, 0, 0) end end addCommandHandler("givemoney", giveSomeoneMoney) function getPlayerFromParticalName(thePlayerName) local thePlayer = getPlayerFromName(thePlayerName) if thePlayer then return thePlayer end for _,thePlayer in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then return thePlayer end end return false end Did everything what they said with your script and it works. EDIT: Edited it after forgetting to change a line back to normal.
-
Everything is possible, but I think you will need to edit the scoreboard for that.
-
bindKey ( "w", blowNoobs ) Also use: getPedOccupiedVehicle
-
You, go immediately learn to read wiki. bool setWaterLevel ( [float x, float y, float z,] float level ) bool setWaterLevel ( [water theWater,] float level ) bool setWaterLevel ( float level [, bool includeWaterFeatures = true, bool includeWaterElements = true ] )
-
I'm crazy that I spend my time on doing this, but ow well, guess I was bored and being too nice. It's highly possible that I made some typos, wrong stuff, etc, etc, etc, because I didn't test it and typed this out of my head. But it was for example anyway. Try to understand it and add it/some stuff to your own code. --Server local marker1 = createMarker(1, 1, 1) local marker2 = createMarker(-1, -1, -1) local team1 = createTeam("Team1", 255, 0, 0) local team2 = createTeam("Team2", 0, 255, 0) function startWar(gType) if (gType == "Team1") then outputChatBox("'"..getTeamName(team1).."' is in the area of '"..getTeamName(team2).."' for too long, war time!") elseif (gType == "Team2") then outputChatBox("'"..getTeamName(team2).."' is in the area of '"..getTeamName(team1).."' for too long, war time!") end end function startWarTimer(tElement) if (source == marker1) then --Marker of Team1 was hitted if (getElementType(tElement) == "player") then --Check or the element is a player if (getPlayerTeam(tElement) == team2) then --Check or he is in the opposite team warTimer1 = setTimer(function() startWar("Team2") end, 10000, 1) --Start the timer (For Team2), if he is longer than 10 seconds in the marker, then start the war! triggerClientEvent("onStartWarTimer", getRootElement(), "timer1") --Start the time on the client's too (Will have more time than the timer on the server because of time between triggering) end end elseif (source == marker2) then if (getElementType(tElement) == "player") then --Check or the element is a player if (getPlayerTeam(tElement) == team1) then --Check or he is in the opposite team warTimer2 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer (For Team1), if he is longer than 10 seconds in the marker, then start the war! triggerClientEvent("onStartWarTimer", getRootElement(), "timer2") --Start the time on the client's too (Will have more time than the timer on the server because of time between triggering) end end end end function stopWarTimer(tElement) if (source == marker1) then if (isTimer(warTimer1)) then --If the timer exists killTimer(warTimer1) --Kill it and kill it at the client's too triggerClientEvent("onKillWarTimer", getRootElement(), "timer1") end elseif (source == marker2) then if (isTimer(warTimer2)) then --If the timer exists killTimer(warTimer2) --Kill it and kill it at the client's too triggerClientEvent("onKillWarTimer", getRootElement(), "timer2") end end end addEventHandler("onMarkerHit", getRootElement(), startWarTimer) addEventHandler("onMarkerLeave", getRootElement(), stopWarTimer) --Client --Remember you need to have 2 progressbars, because both teams can go and enter opposites area's. For more teams add more of course. local cProgressBar1 = guiCreateProgressBar(1, 1, 250, 50, false) local cProgressBar2 = guiCreateProgressBar(1, 50, 250, 50, false) local isRendering1 = false local isRendering2 = false function startFilling() if (isRendering1 == true) then if (guiProgressBarGetProgress(cProgressBar1) < 100) then --If the progress is less than 100, then... local gTime, g2, g3 = getTimerDetails(warTimer1) local gFormattedProgress = math.abs(math.floor((100/10000*gTime))) --Get the correct progress. A progressbar can be from 0 to 100, so do some math. (Mine sucks so this can be wrong... (A)) guiProgressBarSetProgress(cProgressBar1, gFormattedProgress) --After doing some math, set the progress. end end if (isRendering2 == true) then if (guiProgressBarGetProgress(cProgressBar2) < 100) then --If the progress is less than 100, then... local gTime, g2, g3 = getTimerDetails(warTimer2) local gFormattedProgress = math.abs(math.floor((100/10000*gTime))) --Get the correct progress. A progressbar can be from 0 to 100, so do some math. (Mine sucks so this can be wrong... (A)) guiProgressBarSetProgress(cProgressBar2, gFormattedProgress) --After doing some math, set the progress. end end end addEventHandler("onClientRender", getRootElement(), startFilling) function startTimer(gType) if (gType == "timer1") then warTimer1 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer, start filling the progressbar isRendering1 = true elseif (gType == "timer2") then warTimer2 = setTimer(function() startWar("Team1") end, 10000, 1) --Start the timer, start filling the progressbar isRendering2 = true end end addEvent("onStartWarTimer", true) addEventHandler("onStartWarTimer", getRootElement(), startTimer) function stopTimer(gType) if (gType == "timer1") then if (isTimer(warTimer1)) then killTimer(warTimer1) end isRendering1 = false elseif (gType == "timer2") then if (isTimer(warTimer2)) then killTimer(warTimer2) end isRendering2 = false end end addEvent("onKillWarTimer", true) addEventHandler("onKillWarTimer", getRootElement(), stopTimer)
-
affirmative VS negative Ovunque io vada davanti a me trovare quanto ti amo 1. Speak English and 2. If you are here to just ask for help without being thankful but rude, then go away, please.
-
Make it invisible and just place a label infront of it. Use event onClientGUIChanged and then check or it was the editbox, then set the text of the label with guiSetText.
-
Maybe editing the model (.dff)
