-
Posts
1,255 -
Joined
-
Last visited
Everything posted by .:HyPeX:.
-
VotedTable = {} function OnMapStart(mapInfo, mapOptions, gameOptions) RedoVotemapName = mapInfo.name or "Unknown" author = mapInfo.author or "Unknown" voteCount = 0 for v,i in ipairs(getElementsByType("player")) do VotedTable[v] = nil end PlayerCount = getPlayerCount() NeededCountPre = #PlayerCount / 100 NeededCount = NeededCountPre * 60 if ClearNext then Restarted = nil ClearNext = nil end if not Restarted then outputChatBox("#00aaff[Vote#00cc55Redo]: #00aaffNow enabled!", getRootElement(), 255,255,255,true) else ClearNext = true outputChatBox("#00aaff[Vote#00cc55Redo]: #00aaffRedo Already done, #00cc55disabling votes!", getRootElement(), 255,255,255,true) end end addEventHandler("onMapStarting", getRootElement(), OnMapStart()) function VoteRedo(player,cmd) if not VotedTable[player] then VotedTable[player] = player voteCount = #VotedTable outputChatBox("#00aaff[Vote#00cc55Redo]: #00aaff".. getPlayerNametagText(player).." Voted for Redo!, #00cc55Vote Count: #66ffaa[ ".. voteCount.." / "..NeededCount.." ]", getRootElement(), 255,255,255,true) if voteCount >= NeededCount then RedoVoteMap(RedoVotemapName) end else outputChatBox("#00aaff[Vote#00cc55Redo]: #00aaffYou Already #66ffaaVoted!", player, 255,255,255,true) end end addCommandHandler("vr", VoteRedo, false,false) function RedoVoteMap(mapName) mapName = tostring(mapName) if #mapQueue == 0 then outputChatBox("#00aaff[Panel]: Next Map set for Redo", getRootElement(), 255,255,255,true) else outputChatBox("#00aaff[Panel]: Maps Queued for player after Redo", getRootElement(), 255,255,255,true) end table.insert(mapQueue, 1, mapName) end
-
Im facing a problem, how i can find the map name with the event onMapStarting from race gamemode? https://wiki.multitheftauto.com/wiki/Resource:Race I tried mapInfo.name, but it didnt worked.
-
Just a quick update, i found out i can specify a pos at the table and it will automatically move other values down, and now i wana know wich is the minimum value in the table, 0 or 1? table.insert (table, [pos,] value)
-
Hello guys, i got a table where i insert upcoming maps, now, if i want to insert a new map ontop of all of them (on place 1) and move all the rest down, how can i do this? Better explained: MapQueue Table: #1 - Map One #2 - Map Two #3 - Map Three After command: #1 - New Map #2 - Map One #3 - Map Two #4 - Map Three Thanks in advance, HyPeX
-
I'd recommend vortex servers, they work at amazing speeds and so far, our server is hosted there since 2 or 3 months. (LxG) https://vortexservers.com/
-
Aparently with what i did it no longer lags, thanks for the help guys! (global>local & onClientPreRender>onClientRender)
-
Normaly, you shold do this: police = getTeamFromName("Police - Team - Name - Here") After that, if the team exists, it should work.
-
Check the whole script, up there. function AnimacionCuadros() local ahora3 = ahora2 local despues = getTickCount() local tpasado = despues - ahora3 local durado = ( ahora3 + 2000 ) - ahora3 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 local ahora4 = ahora if despues - ahora4 >= 6000 then local tpasado1 = despues - ( ahora4 + 6000) local durado1 = ( ahora4 + 7000 ) - ( ahora4 + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end
-
Im gonna test it, thanks!
-
Fixed it. Im uploading it too to the comunity, but not many scripting people look at comunity.
-
Hello guys, i did this script to help me out doing some scripts arround with cameraMatrix functions, hope you will use it. Little desc: Type in '/camera' into chat or type it into console. It will automatically display into the console Position and rotation in X,Y,Z and LX,LY,LZ respectively. This will also copy it into your clipboard for faster use outisde mta. Credits: Socialz - Helped me with the clipboard function. Link Here
-
Yes it worked with 0. But only with getAlivePlayers and im getting problems im trying to fix over here
-
Just Turned out to locals all the global stuff by renaming them locally and then using it locally and changed to onClientRender supposing onClientPreRender may lag for a setCameraMatrix if it works before world loading. outputChatBox("#00cc55Podium Script Client Side by HyPeX Loaded!", 255,255,255,true) function setPlaceCheck(player, place) local players = getElementsByType ( "player" ) if place then if getElementType(player)=="player" then if place == "1" then Lugar1 = player SetPodiumPlayers(player, Lugar2, Lugar3) elseif place == "2" then Lugar2 = player elseif place == "3" then Lugar3 = player end end end end addEvent("PlayerPosWasted", true) addEventHandler("PlayerPosWasted", getRootElement(), setPlaceCheck) function ResetPositions() end addEvent("ResetPositionsPodium",true) addEventHandler("ResetPositionsPodium", getRootElement(), ResetPositions) PodiumFont = dxCreateFont("fonts/podium.ttf",20, true) local Lugar1 = "Winner" local Lugar2 = "Second" local Lugar3 = "Third" function SetPodiumPlayers(first,second,third) Lugar1 = getPlayerNametagText(first) Lugar2 = getPlayerNametagText(second) Lugar3 = getPlayerNametagText(third) executeCommandHandler("gan") end addEvent("DameTops",true) addEventHandler("DameTops", getRootElement(), SetPodiumPlayers) function AnimacionCamara() local LX = 1233.4166259766 local X = 1288.1177978516 local LZ = 5.4866232872009 local Z = 35.953266143799 local LY = -1783.8197021484 local Y = -1861.7912597656 setElementPosition(veh1,1275.9250488281,-1823.6090087891,13.187000274658) setElementPosition(veh2,1273.8000488281,-1830.8089599609,13.187000274658) setElementPosition(veh3,1271.9250488281,-1837.6090087891,13.187000274658) setElementRotation(veh1, 0,0,76) setElementRotation(veh2, 0,0,64) setElementRotation(veh3, 0,0,88) local x,y,z = getElementPosition(veh2) camara = setCameraMatrix(X,Y,Z,x,y,z) local despues = getTickCount() local ahora2 = ahora if despues - ahora2 >= 2000 then local InicioInto2 = InicioInto local tpasado = despues - InicioInto2 local durado = ( InicioInto2 + 2000 ) - InicioInto2 local progress = tpasado / durado local mX,mY,mZ = interpolateBetween(X,Y,Z, 1236.4932861328, -1817.7264404297, 23.722217559814, progress, "OutQuad") camera = setCameraMatrix(mX,mY,mZ,x,y,z) end end function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientRender", getRootElement(), AnimacionCuadros) timer10 = nil end, 1000, 1) timer11 = setTimer(function() fadeCamera(false,1) timer11 = nil end, 1000, 1) timer12 = setTimer(function() executeCommandHandler("gan") fadeCamera(true,1) timer12 = nil end, 7000, 1) veh1 = createVehicle(411, 1275.9250488281,-1823.6090087891,13.187000274658,0,0,76) setElementStreamable(veh1, false) veh2 = createVehicle(411, 1273.8000488281,-1830.8089599609,13.187000274658,0,0,63.997924804688) setElementStreamable(veh2, false) veh3 = createVehicle(411, 1271.9250488281,-1837.6090087891,13.187000274658,0,0,88) setElementStreamable(veh3, false) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setCameraTarget(getLocalPlayer()) fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", 255,255,255,true) else on = nil setElementStreamable(veh1, true) setElementStreamable(veh2, true) setElementStreamable(veh3, true) destroyElement(veh1) destroyElement(veh2) destroyElement(veh3) destroyElement(ped1) destroyElement(ped2) destroyElement(ped3) outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientRender", getRootElement(), AnimacionCuadros) removeEventHandler("onClientRender", getRootElement(), AnimacionCamara) end end addCommandHandler("gan", IniciarAnimacion, false) function AnimacionCuadros() local ahora3 = ahora2 local despues = getTickCount() local tpasado = despues - ahora3 local durado = ( ahora3 + 2000 ) - ahora3 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 local ahora4 = ahora if despues - ahora4 >= 6000 then local tpasado1 = despues - ( ahora4 + 6000) local durado1 = ( ahora4 + 7000 ) - ( ahora4 + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end
-
Hmm i thought about creating a table on map start.. and only use that table..but then the problem is that i dont have how to calculate how many of them are dead.. EDIT: Should this work? DeadTable = {} function AutomaticSetPlayer() DeadTable[source] = source if get("AutomaticPodium") == "true" then local TotalPlayers = #PlayingTable local DeadPlayers = #DeadTable local playerRank = TotalPlayers - DeadPlayers if playerRank == 2 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished third!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "3") elseif playerRank == 1 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished second!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "2") elseif playerRank == 0 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished First!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "1") else outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Died!", getRootElement(), 255,255,255,true) end end end addEventHandler("onPlayerWasted", getRootElement(), AutomaticSetPlayer) function SetPlayerTable() PlayingTable = nil PlayingTable = {} for v,i in ipairs(getElementsByType("players")) do PlayingTable[v] = v DeadTable[v] = nil end end addEventHandler("onMapStarting", getRootElement(), SetPlayerTable)
-
Loop will have wich speed? also, im using onClientPreRender to have more power to do the action... and i try to only use local in places where needed, since a local cant be used on another function. Wold i work if i save the global as local and then use it?
-
Guys, im stuck, totally. The idea of this podium is to get the current players still alive racing with getAlivePlayers. Yeah it works. Now the problem is: getAlivePlayers will include also joined and waiting players. So, if a player joins while the race, he's counted as an alive player, and the rank 1 is never reached. So, how can i fix this? i appreaciate any help script: function AutomaticSetPlayer() if get("AutomaticPodium") == "true" then local players = getAlivePlayers() local playerRank = #players if playerRank == 2 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished third!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "3") elseif playerRank == 1 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished second!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "2") elseif playerRank == 0 then outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Finished First!", getRootElement(), 255,255,255,true) triggerClientEvent("PlayerPosWasted", getRootElement(), source, "1") else outputChatBox("#00cc55Player "..getPlayerNametagText(source).." Died!", getRootElement(), 255,255,255,true) end end end addEventHandler("onPlayerWasted", getRootElement(), AutomaticSetPlayer) Thanks in advance, HyPeX
-
Separating a string with a new line "Help Required"
.:HyPeX:. replied to -ffs-AbodyRulez's topic in Scripting
i had a post about something similar before, it might help you in the future, the code was in the end this: local array = { x = 1, y = 2, z = 3, lx = 1, ly = 2, lz = 3 } function splitArrayIntoLines( _array ) if ( type( _array ) ~= "table" ) then return "" end local splitted = "" local formed = { } for i,v in pairs( _array ) do formed[ #formed + 1 ] = i .. ": " .. v end -
Hello guys, i've set up a podium system where all the players are sent the players to client side who won and then it is reproduced a short client-sided animation on the client. The problem is that this apparently lags on the server with alot of players, something it shouldnt, since it is client-sided. Any idea? outputChatBox("#00cc55Podium Script Client Side by HyPeX Loaded!", 255,255,255,true) function setPlaceCheck(player, place) local players = getElementsByType ( "player" ) if place then if getElementType(player)=="player" then if place == "1" then Lugar1 = player SetPodiumPlayers(player, Lugar2, Lugar3) elseif place == "2" then Lugar2 = player elseif place == "3" then Lugar3 = player end end end end addEvent("PlayerPosWasted", true) addEventHandler("PlayerPosWasted", getRootElement(), setPlaceCheck) function ResetPositions() end addEvent("ResetPositionsPodium",true) addEventHandler("ResetPositionsPodium", getRootElement(), ResetPositions) PodiumFont = dxCreateFont("fonts/podium.ttf",20, true) local Lugar1 = "Winner" local Lugar2 = "Second" local Lugar3 = "Third" function SetPodiumPlayers(first,second,third) Lugar1 = getPlayerNametagText(first) Lugar2 = getPlayerNametagText(second) Lugar3 = getPlayerNametagText(third) executeCommandHandler("gan") end addEvent("DameTops",true) addEventHandler("DameTops", getRootElement(), SetPodiumPlayers) function AnimacionCamara() local LX = 1233.4166259766 local X = 1288.1177978516 local LZ = 5.4866232872009 local Z = 35.953266143799 local LY = -1783.8197021484 local Y = -1861.7912597656 setElementPosition(veh1,1275.9250488281,-1823.6090087891,13.187000274658) setElementPosition(veh2,1273.8000488281,-1830.8089599609,13.187000274658) setElementPosition(veh3,1271.9250488281,-1837.6090087891,13.187000274658) setElementRotation(veh1, 0,0,76) setElementRotation(veh2, 0,0,64) setElementRotation(veh3, 0,0,88) local x,y,z = getElementPosition(veh2) camara = setCameraMatrix(X,Y,Z,x,y,z) local despues = getTickCount() if despues - ahora >= 2000 then local tpasado = despues - InicioInto local durado = ( InicioInto + 2000 ) - InicioInto local progress = tpasado / durado local mX,mY,mZ = interpolateBetween(X,Y,Z, 1236.4932861328, -1817.7264404297, 23.722217559814, progress, "OutQuad") camera = setCameraMatrix(mX,mY,mZ,x,y,z) end end function IniciarAnimacion() if not on then on = true ahora = getTickCount() timerInto = setTimer(function() InicioInto = getTickCount() timerInto = nil end, 2000,1) timer10 = setTimer(function() ahora2 = getTickCount() addEventHandler("onClientPreRender", getRootElement(), AnimacionCuadros) timer10 = nil end, 1000, 1) timer11 = setTimer(function() fadeCamera(false,1) timer11 = nil end, 1000, 1) timer12 = setTimer(function() executeCommandHandler("gan") fadeCamera(true,1) timer12 = nil end, 7000, 1) veh1 = createVehicle(411, 1275.9250488281,-1823.6090087891,13.187000274658,0,0,76) setElementStreamable(veh1, false) veh2 = createVehicle(411, 1273.8000488281,-1830.8089599609,13.187000274658,0,0,63.997924804688) setElementStreamable(veh2, false) veh3 = createVehicle(411, 1271.9250488281,-1837.6090087891,13.187000274658,0,0,88) setElementStreamable(veh3, false) ped2 = createPed(1,1083.2900390625,-1843.2590332031,13.546899795532,0) ped1 = createPed(2,1081.1309814453,-1843.4270019531,13.546899795532,0) ped3 = createPed(301,1078.9940185547,-1843.4270019531,13.546899795532,0) warpPedIntoVehicle(ped1, veh1,0) warpPedIntoVehicle(ped2, veh2,0) warpPedIntoVehicle(ped3, veh3,0) setCameraTarget(getLocalPlayer()) fadeCamera(false, 1) local ver = setTimer(function() fadeCamera(true, 1) addEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) ver = nil end, 1500, 1) outputChatBox("Gan ON", 255,255,255,true) else on = nil setElementStreamable(veh1, true) setElementStreamable(veh2, true) setElementStreamable(veh3, true) destroyElement(veh1) destroyElement(veh2) destroyElement(veh3) destroyElement(ped1) destroyElement(ped2) destroyElement(ped3) outputChatBox("Gan OFF", getRootElement(), 255,255,255,true) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCuadros) removeEventHandler("onClientPreRender", getRootElement(), AnimacionCamara) end end addCommandHandler("gan", IniciarAnimacion, false) function AnimacionCuadros() local despues = getTickCount() local tpasado = despues - ahora2 local durado = ( ahora2 + 2000 ) - ahora2 local progress = tpasado / durado local x,y = guiGetScreenSize() alpha = 255 if despues - ahora >= 6000 then local tpasado1 = despues - ( ahora + 6000) local durado1 = ( ahora + 7000 ) - ( ahora + 6000 ) local progress1 = tpasado1 / durado1 alpha, x2, x3 = interpolateBetween(255, 0,0,0,0,0, progress1, "Linear") end local rec1, rec2, rec3 = interpolateBetween(0,0,y*1.5,0,0,y/1.23, progress, "Linear") local lin1, lin2, lin3 = interpolateBetween(0,0,y*1.5,0,0,y/1.011, progress, "Linear") local lin4, lin5, lin6 = interpolateBetween(0,0,y*1.5,0,0,y/1.245, progress, "Linear") local lin7, lin8, lin9 = interpolateBetween(0,0,y*1.5,0,0,y/1, progress, "Linear") local all1, all2, all3 = interpolateBetween(0,0,y*1.5,0,0,y/1.263, progress, "Linear") local tex1, tex2, tex3 = interpolateBetween(0,0,y*1.5,0,0,y/1.21, progress, "Linear") local tex4, tex5, tex6 = interpolateBetween(0,0,y*1.5,0,0,y/1.12, progress, "Linear") dxDrawRectangle(x/7.5, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/2.535, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawRectangle(x/1.523, rec3, x/4, y/6,tocolor(0,0,0,alpha), true) dxDrawLine(x/8, lin3, x/1.09, lin3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/7.8, lin9, x/7.8, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/8.15, lin6, x/1.09, lin6, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.097, lin9, x/1.097, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/2.58, lin9, x/2.58, all3, tocolor(0,170,255,alpha), 16, true) dxDrawLine(x/1.54, lin9, x/1.54, all3, tocolor(0,170,255,alpha), 16, true) --Text Shit --Place 1 local Clear1 = string.gsub(Lugar1, "#%x%x%x%x%x%x", "") local text1 = dxGetTextWidth(Clear1, 0.8, PodiumFont) if text1 < 250 then textScale1 = 0.8 placeX1 = x/5 elseif text1 > 251 and text1 < 300 then textScale1 = 0.7 placeX1 = x/5.8 elseif text1 > 301 and text1 < 350 then placeX1 = x/6 textScale1 = 0.6 elseif text1 > 351 then textScale1 = 0.5 placeX1 = x/6 end --Place 2 local Clear2 = string.gsub(Lugar2, "#%x%x%x%x%x%x", "") local text2 = dxGetTextWidth(Clear2, 0.8, PodiumFont) if text2 < 250 then textScale2 = 0.8 placeX2 = x/2.2 elseif text2 > 251 and text2 < 300 then textScale2 = 0.7 placeX2 = x/2.25 elseif text2 > 301 and text2 < 350 then textScale2 = 0.6 placeX2 = x/2.3 elseif text2 > 351 then textScale2 = 0.5 placeX2= x/2.3 end --Place 3 local Clear3 = string.gsub(Lugar3, "#%x%x%x%x%x%x", "") local text3 = dxGetTextWidth(Clear3, 0.8, PodiumFont) if text3 < 250 and text3 > 150 then textScale3 = 0.8 placeX3 = x/1.42 elseif text3 < 149 then textScale3 = 0.8 placeX3 = x/1.36 elseif text3 > 251 and text3 < 300 then placeX3 = x/1.42 textScale3 = 0.7 elseif text3 > 301 and text3 < 349 then textScale3 = 0.6 placeX3 = x/1.42 elseif text3 > 350 then textScale3 = 0.5 placeX3 = x/1.42 end --Draw dxDrawText("#D9D919Winner:", x/5, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#E6E8FASecond:", x/2.2, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText("#D98719Third:", x/1.37, tex3, x/4, y/1, tocolor(255,255,255,alpha), 0.8, PodiumFont, center, center, false,false,true,true) dxDrawText(Lugar1, placeX1, tex6, x/5.5, y/1, tocolor(255,255,255,alpha), textScale1, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar2, placeX2, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale2, PodiumFont, center, center, true,true,true,true) dxDrawText(Lugar3, placeX3, tex6, x/4, y/1, tocolor(255,255,255,alpha), textScale3, PodiumFont, center, center, true,true,true,true) end
-
Guys got a problem with this code, first the command always turns off, and if i use the state to turn it on force, it doesnt do anything, according to the admin panel, the setting is still false, and admin cannot modify it. EDIT//: Aparently, the function alone without state will turn to current state, if i force it to true, then it will always display ON without state. function ToggleAutomatic(player,cmd,state) local account = getPlayerAccount(player) local accountName = getAccountName(account) if (isObjectInACLGroup("user." ..accountName, aclGetGroup("Admin"))) then if getPlayerCount() >= 3 then if state then if state == "true" or state == "false" then if state == "true" then set("AutomaticPodium", "true") set("TurnPodium", "true") stateturn = "ON" elseif state == "false" then stateturn = "OFF" set("AutomaticPodium", "false") set("TurnPodium", "false") end outputChatBox("#FF0000Automatic Podium was turn ".. stateturn, player,255,255,255,true) else outputChatBox("#FF0000Please enter a valid value! [true,false]", player, 255,255,255,true) end else if get("AutomaticPodium") == "true" then set("AutomaticPodium", "true") set("TurnPodium", "true") outputChatBox("#FF0000Automatic Podium was turn ON", player,255,255,255,true) else set("AutomaticPodium", "false") set("TurnPodium", "false") outputChatBox("#FF0000Automatic Podium was turn OFF", player,255,255,255,true) end end else if get("TurnPodium") == "false" then outputChatBox("#FF0000There must be at least 3 players online for script to work!", player, 255,255,255,true) outputChatBox("#FF0000Script will automatically turn on when there are 3 players online.", player, 255,255,255,true) set("TurnPodium", "true") elseif get("TurnPodium") == "true" then outputChatBox("#FF0000Script will no longer automatically start when there are more than 3 players online", player, 255,255,255,true) set("TurnPodium", "false") end end else outputChatBox("#FF0000This is only for admins!", player, 255,255,255,true) end end addCommandHandler("PodiumTurn", ToggleAutomatic,false) Meta: <meta> <info name="HyPeX's Podium Script" description="" author="HyPeX" type="script" version="1.0.0"/> <file src="fonts/podium.ttf" /> <script src="ganadores.lua" type="client" /> <script src="ganadores_s.lua" type="server" /> <export function="setPodiumPlayers" /> <settings> <setting name="*AutomaticPodium" value="false" friendlyname="On/Off Podium automatic" group="" accept="true,false" examples="true,false" desc="Dont touch this, use the script command." /> <setting name="*TurnPodium" value="false" friendlyname="On/Off Podium automatic" group="" accept="true,false" examples="true,false" desc="Dont touch this, use the script command." /> </settings> </meta>
-
Yeah, that was my supposition after i readed the none thingy. But, how will it output if i do #getAlivePlayers and count is none, will it be nil?
-
Please, just answer my question, i now know only this could be done server side and sent client side after ir eaded the functions, I want to know if onPlayerWasted will display the number of people left after the source died, or before it died (SUPPOSING OBIOUSLY I TRIGGER getAlivePlayers ON IT!)
-
Hey guys, if i want to know how many players are alive, onClientPlayerWasted will return the actual alive players after the current trigger, or before the trigger? like if the player who died was the 3rd and only two remaining, then a # on getAlivePlayers will return 3 or 2? And this applies as same to the server-side trigger? Thanks HyPeX
-
Guys, how can i create a rectangle at a location in the world? so as to attach it to a vehicle, and if it moves or i move, it is still on the vehicle.
-
OnClientRender would be a waste if you want to make it every 5 sec, and cant be used server-side. I suggest you using a timer with infinite loop, like this: LoopTimer = setTimer(function() --Do Stuff end, 5000, 0)
