-
Posts
186 -
Joined
Everything posted by RenanPG
-
local function ujteamsay(message, messageType) if messageType == 2 then cancelEvent() local team = getPlayerTeam(source) if(team) then for i,player in pairs(getPlayersInTeam(team)) do outputChatBox("(CSOPORT) "..getPlayerName(source)..": #FFffFF"..message, player, red, green, blue, true ) end end end end addEventHandler("onPlayerChat", root, ujteamsay)
-
setTimer(function(), local time = getRealTime() if(time.hour == "21" and time.minute == "0") then elseif(time.hour == "5" and time.minute == "0") then end end, 60000, 0)
-
I'm not sure if mta browser enable cookies, try this to store on JS... http://www.w3schools.com/js/js_cookies.asp
-
I think it is easier for your purpose: (You'll need to create an object alpha 0 and attach to your car) https://wiki.multitheftauto.com/wiki/MoveObject
-
onClientRender interpolateBetween
-
Somente em server o player é passado como parâmetro(no caso thePlayer). function showVehicleName () local theVehicle = getPedOccupiedVehicle (localPlayer) if theVehicle then outputChatBox ( "Name of the Vehicle: " .. getVehicleName ( theVehicle ), thePlayer ) else outputChatBox ( "You do not have a Vehicle!", thePlayer, 255, 0, 0, true ) end end addCommandHandler ( "getcarname", showVehicleName )
-
addEventHandler("onClientKey", getRootElement(), function(button, press) if(button == "space") then local keyState = getKeyState("w") if(keyState) then cancelEvent() end end end)
-
It is not possible to cancel bindKey function, only via event.
-
Something like this? toggleControl("sprint", false)
-
addEventHandler("onClientKey", root, function(key, press) if(key == "w") then cancelEvent() end end) https://wiki.multitheftauto.com/wiki/OnClientKey
-
Take a look on Performancebrowser to check server usage first... it seems like high usage of bandwidth, memory or even overloaded cpu. https://wiki.multitheftauto.com/wiki/Re ... ncebrowser
-
I'm not sure how to do it correctly, but you need a recursion to loop through the sub tables. Something like this below: function table.getIndexByValue(t,value) for i,v in pairs(t) do -- or ipairs, if count zero if(v == value) then return i elseif(type(v) == "table") then return table.getIndexByValue(v,value) -- recursion, call the same function for internal tables end end end
-
Any difference between isGuestAccount and getAccount?
RenanPG replied to goodiewarrior's topic in Scripting
Yes, it has difference. When you are not logged in, automatically you get an guest account(when you quit the game, this account is deleted, consequently all data of this account will be lost). So, if you check using getPlayerAccount() it will return the account being guest or not, to be sure that the player logged in use isGuestAccount() after you got the account from the player using getPlayerAccount(). https://wiki.multitheftauto.com/wiki/IsGuestAccount https://wiki.multitheftauto.com/wiki/GetPlayerAccount -
setCursorAlpha(0) function show() local showing = isCursorShowing () if showing then local screenx, screeny = getCursorPosition() dxDrawImage(screenx, screeny, 50, 50, 'files/crosshair.png') end end addEventHandler('onClientRender', root, show )
-
function meteoro(targetPlayer) local x, y, z = getElementPosition(getLocalPlayer()) createProjectile(getLocalPlayer(),20, x ,y, z+10, 2, getLocalPlayer()) end addCommandHandler("meteoro", meteoro) Parece que o erro do seu código era apenas o id, pois somente o projétil 20 se direciona ao Target.
-
https://wiki.multitheftauto.com/wiki/OnClientCursorMove https://wiki.multitheftauto.com/wiki/OnClientMouseMove
-
De nada.
-
Esse erro ocorreu pq não tem como concatenar um elemento (no caso o player) com uma string, o certo seria usar o nome da conta. segue o exemplo abaixo: local account = getPlayerAccount(player) if(account) then -- caso exista local accountName = getAccountName(account) if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Console" ) ) then -- caso a conta seja Console end end
- 1 reply
-
- 1
-
Por que não vai funcionar?
-
markers = { {x = -1990.24292, y = 262.62424, z = 34.00000}, } for i,marker in pairs(markers) do createMarker(marker.x, marker.y, marker.z, "cylinder", 4, 0, 141, 255, 255, getRootElement( ) ) end Não entendi muito bem oque você está tentando fazer, mas se é pra criar Markers com uma table poderia ser assim.
-
Uma opção além das citadas poderia ser o próprio database do mta registry.db, através da função executeSQLQuery. No link abaixo explica um pouco sobre o uso e também alguns exemplos de comandos em SQL. https://wiki.multitheftauto.com/wiki/ExecuteSQLQuery
-
Você ta com o time freeze? ou game speed maior que 1?
-
Acabei de testar e funciona, seta 23:59 no painel admin para ver.
-
Não sei se existe uma função para pegar dia de semana, mas da pra fazer uma gambiarra tipo essa pra atualizar o dia conforme o horário do getTime: local dias = { [0] = "Domingo"; [1] = "Segunda"; [2] = "Terça"; [3] = "Quarta"; [4] = "Quinta"; [5] = "Sexta"; [6] = "Sábado" } local dia = 0 setTimer(function() local h, m = getTime() if(h == 0 and m == 0) then if(dia == 6) then dia = 0 else dia = dia + 1 end end end, 1000, 0) addEventHandler( "onClientRender", root, function () dxDrawText( dias[dia], 1045, 606, 1105, 624, tocolor(255, 255, 255, 255), 1.00, "default", "left", "center", false, false, false, false, false) end )