-
Posts
28 -
Joined
-
Last visited
vx200's Achievements
Rat (9/54)
3
Reputation
-
A playSound funkció kliensoldali. Ezt kliensként kell használnia kiszolgáló helyett, ezért próbálja meg ezt: function Zene () local sound = playSound("zene.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onClientPlayerJoin", localPlayer Zene)
-
Função para detectar morte do jogador no server: onPlayerWasted - Multi Theft Auto: Wiki No client: onClientPlayerWasted - Multi Theft Auto: Wiki Utilizando o onClientPlayerWasted: messages = { "Better luck next time", "Don't think you're so cool now, do you?", "Nice one, pal", "Your opinion is void" } function wastedMessage ( killer, weapon, bodypart ) local randomID = math.random ( 1, #messages ) --get a random ID from the table local randomMessage = messages[randomID] --use that to retrieve a message outputChatBox ( randomMessage, 255, 0, 0 ) --output the message end addEventHandler ( "onClientPlayerWasted", getLocalPlayer(), wastedMessage ) --add an event for the local player only Utilizando o onPlayerWasted: -- register player_Wasted as a handler for onPlayerWasted function player_Wasted ( ammo, attacker, weapon, bodypart ) -- if there was an attacker if ( attacker ) then -- we declare our variable outside the following checks local tempString -- if the element that killed him was a player, if ( getElementType ( attacker ) == "player" ) then -- put the attacker, victim and weapon info in the string tempString = getPlayerName ( attacker ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")" -- else, if it was a vehicle, elseif ( getElementType ( attacker ) == "vehicle" ) then -- we'll get the name from the attacker vehicle's driver tempString = getPlayerName ( getVehicleController ( attacker ) ).." killed "..getPlayerName ( source ).." ("..getWeaponNameFromID ( weapon )..")" end -- if the victim was shot in the head, append a special message if ( bodypart == 9 ) then tempString = tempString.." (HEADSHOT!)" -- else, just append the bodypart name else tempString = tempString.." ("..getBodyPartName ( bodypart )..")" end -- display the message outputChatBox ( tempString ) -- if there was no attacker, else -- output a death message without attacker info outputChatBox ( getPlayerName ( source ).." died. ("..getWeaponNameFromID ( weapon )..") ("..getBodyPartName ( bodypart )..")" ) end end addEventHandler ( "onPlayerWasted", root, player_Wasted )
-
vx200 changed their profile photo
-
You need to start pAttach and then start your script. Always start he dependency before starting the scripts that depends on your dependency. start pAttach -> then start your script. do not start your script then start pAttach.
-
You can set the element visible to in the marker: marker createMarker ( float x, float y, float z [, string theType = "checkpoint", float size = 4.0, int r = 0, int g = 0, int b = 255, int a = 255, element visibleTo = getRootElement( ) ] )
-
The error is clearly on your debugscript. Just start the rsource pAttach that your script is requesting.
-
You can set data to the the item from the gridlist and get it later, Idk if it's what you want but it should work: DGS = exports.dgs function clientsideResourceStart () local numberList = DGS:dgsCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) local column = DGS:dgsGridListAddColumn ( numberList, "Column Title", 0.85 ) if ( column ) then local row = DGS:dgsGridListAddRow ( numberList ) local myItem = DGS:dgsGridListSetItemText ( numberList, row, column, tostring( math.random(0, 10) ^ 100 ) ) DGS:dgsGridListSetItemData ( numberList, row, column, "Test" ) local myItemData = DGS:dgsGridListGetItemData ( numberList, row, column ) outputChatBox ( "My gridlist item data: " .. myItemData ) end end addEventHandler ( "onClientResourceStart", resourceRoot, clientsideResourceStart )
-
If possible, share your fix, so if anyone else face this he can fix too
-
Você precisa usar o evento: -- Client: addEventHandler("onClientPlayerQuit", root, function()) -- Server: addEventHandler("onPlayerQuit", root, function()) Ao triggar este evento, você irá utilizar o destroy element no carro: destroyElement(carro) Envie nos o código do painel para te ajudarmos melhor
-
Fazer aparece o painel quando passar no marker!
vx200 replied to matheu_yu's topic in Programação em Lua
Algumas funções tem o lado client e o lado server, o MarkerHit é um exemplo. Para usar como client: addEventHandler("onClientMarkerHit", marker, função) No server-side: addEventHandler("onMarkerHit", marker, função) Arrumei seu código, você pode colar isso aqui em seu client script e deve funcionar: local visible = false local mrk = createMarker (2493.9443359375,-952.806640625,81.248107910156, "cylinder", 2, 211, 102 ,13) local screenW, screenH = guiGetScreenSize() function painel() dxDrawLine((screenW * 0.2632) - 1, (screenH * 0.3021) - 1, (screenW * 0.2632) - 1, screenH * 0.7526, tocolor(45, 191, 25, 254), 1, false) dxDrawLine(screenW * 0.7801, (screenH * 0.3021) - 1, (screenW * 0.2632) - 1, (screenH * 0.3021) - 1, tocolor(45, 191, 25, 254), 1, false) dxDrawLine((screenW * 0.2632) - 1, screenH * 0.7526, screenW * 0.7801, screenH * 0.7526, tocolor(45, 191, 25, 254), 1, false) dxDrawLine(screenW * 0.7801, screenH * 0.7526, screenW * 0.7801, (screenH * 0.3021) - 1, tocolor(45, 191, 25, 254), 1, false) dxDrawRectangle(screenW * 0.2632, screenH * 0.3021, screenW * 0.5169, screenH * 0.4505, tocolor(35, 75, 33, 244), false) dxDrawText("Trabalho Ilegal -BVC", screenW * 0.2559, screenH * 0.3021, screenW * 0.7750, screenH * 0.3607, tocolor(96, 248, 88, 254), 1.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("Ganho: R$ 580", screenW * 0.4169, screenH * 0.4688, screenW * 0.6110, screenH * 0.5625, tocolor(16, 189, 7, 254), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawLine((screenW * 0.4176) - 1, (screenH * 0.5977) - 1, (screenW * 0.4176) - 1, screenH * 0.6641, tocolor(16, 189, 7, 254), 1, false) dxDrawLine(screenW * 0.6125, (screenH * 0.5977) - 1, (screenW * 0.4176) - 1, (screenH * 0.5977) - 1, tocolor(16, 189, 7, 254), 1, false) dxDrawLine((screenW * 0.4176) - 1, screenH * 0.6641, screenW * 0.6125, screenH * 0.6641, tocolor(16, 189, 7, 254), 1, false) dxDrawLine(screenW * 0.6125, screenH * 0.6641, screenW * 0.6125, (screenH * 0.5977) - 1, tocolor(16, 189, 7, 254), 1, false) dxDrawRectangle(screenW * 0.4176, screenH * 0.5977, screenW * 0.1949, screenH * 0.0664, tocolor(107, 0, 0, 254), false) dxDrawText("Pegar Trabalho ", screenW * 0.4169, screenH * 0.5951, screenW * 0.6125, screenH * 0.6641, tocolor(207, 141, 36, 199), 1.00, "pricedown", "center", "center", false, false, false, false, false) dxDrawText("Carga de Maconha", screenW * 0.4206, screenH * 0.3867, screenW * 0.6110, screenH * 0.4557, tocolor(107, 0, 0, 254), 2.00, "diploma", "center", "center", false, false, false, false, false) end function abrirPainel() if not visible then visible = true addEventHandler("onClientRender", getRootElement(), painel) else visible = false removeEventHandler("onClientRender", getRootElement(), painel) end end addEventHandler("onClientMarkerHit", mrk, abrirPainel) addEventHandler("onClientMarkerLeave", mrk, function () visible = false removeEventHandler("onClientRender", getRootElement(), painel) end) -
Sorry. I didn't understand your question. Do you want to have the count of users on your DISCORD server from your mta? Example, do you want to run /users on your MTA server and get the count of users from your DISCORD server?
-
Há muito conteúdo disponível na internet. Você pode aprender até lendo scripts de outras pessoas, você pode encontrar vários no repositório de resources do próprio MTA: Há muitos videos tambem. Como Programar Em Lua - MTA #1: Até no próprio WIKI do mta tem uma introdução ao scripting: Espero ver você em breve
-
Basta remover a condicional do inWater então. function setPlayerOnFire(cmd, playerName) local player = getPlayerFromName ( playerName ) if player then local notOnFire = not isPedOnFire(player) if notOnFire then setPedOnFire(player, true) end end end addCommandHandler("fogo", setPlayerOnFire) Espero que esse funcione