Leaderboard
Popular Content
Showing content with the highest reputation on 17/12/18 in all areas
-
?? ? ( اليوم احب اقدم لكم ) ? ? ( فري روم سيرفر مملكة الهجولة ) ? ? ( الفري روم مو مشفر لعيونكم ) ? (انا تركت حقوق هيرو وبومبا بعد ما تعبت) : رابط المود ?( التحميل )? الاهداءت @MR.Mosa @Kareem Amer @Mr.Falcon @TOUNSI | ا̍ڸــڛۣــ؏ــٰٱ̍دہ @*RayaN-Alharbi. والسلام عليكم ورحمه الله وبركاته1 point
-
Pronto. veh = {} vehCol = {} function veiculodayz (thePlayer) local accountname = getAccountName (getPlayerAccount (thePlayer)) -- accountname recebe o nome da conta do jogador que usou o comando. if isObjectInACLGroup ("user."..accountname, aclGetGroup ("Admin")) then -- Se o nome da conta estiver na ACL Group Admin, então: local x, y, z = getElementPosition (thePlayer) -- x, y, z recebem a posição do jogador que usou o comando. if isElement (veh[thePlayer]) then -- Se já existe o veh[thePlayer] criado, então: spawnVehicle (veh[thePlayer], x+3, y, z) -- Spawna ele perto do jogador, sem criar outro. setElementData (vehCol[thePlayer], "parent", veh[thePlayer]) -- Reseta as datas do colider. setElementData (veh[thePlayer], "parent", vehCol[thePlayer]) setElementData (vehCol[thePlayer], "vehicle", true) setElementData (vehCol[thePlayer], "Tire_inVehicle", 4) setElementData (vehCol[thePlayer], "Engine_inVehicle", 1) setElementData (vehCol[thePlayer], "Parts_inVehicle", 1) setElementData (vehCol[thePlayer], "fuel", 10000) else -- Se não existe um veh[thePlayer] criado, então: veh[thePlayer] = createVehicle (489, x+3, y, z) -- Cria o veh[thePlayer]. setVehicleColor (veh[thePlayer], 0, 0, 0) -- Coloca ele na cor preta. if isElement (vehCol[thePlayer]) then -- Se já existe o colider (veículo foi deletado e o colider ficou lá), então: attachElements (vehCol[thePlayer], veh[thePlayer], 0, 0, 0) -- Anexa o colider novamente ao veh[thePlayer]. else -- Se não existe colider nenhum, então: vehCol[thePlayer] = createColSphere (x, y, z, 2.5) -- Cria o colider. attachElements (vehCol[thePlayer], veh[thePlayer], 0, 0, 0) -- Anexa ele ao veh[thePlayer]. end setElementData (vehCol[thePlayer], "parent", veh[thePlayer]) -- Seta as datas no veh[thePlayer] e no colider. setElementData (veh[thePlayer], "parent", vehCol[thePlayer]) setElementData (vehCol[thePlayer], "vehicle", true) setElementData (vehCol[thePlayer], "Tire_inVehicle", 4) setElementData (vehCol[thePlayer], "Engine_inVehicle", 1) setElementData (vehCol[thePlayer], "Parts_inVehicle", 1) setElementData (vehCol[thePlayer], "fuel", 10000) end end end addCommandHandler ("carro", veiculodayz)1 point
-
tenta isso veh = {} vehCol = {} function veiculodayz(thePlayer) local accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then if veh[thePlayer] then DestroyElement(veh[thePlayer]) DestroyElement(vehCol[thePlayer]) end local x, y, z = getElementPosition(thePlayer) veh[thePlayer] = createVehicle(411, x+3, y, z) setVehicleColor(veh[thePlayer],255,255,255) vehCol[thePlayer] = createColSphere(x, y, z, 2.5) attachElements( vehCol, veh, 0, 0, 0 ) setElementData(vehCol[thePlayer],"parent",veh) setElementData(veh[thePlayer],"parent",vehCol) setElementData(vehCol[thePlayer],"vehicle",true) setElementData(vehCol[thePlayer],"Tire_inVehicle",4) setElementData(vehCol[thePlayer],"Engine_inVehicle",1) setElementData(vehCol[thePlayer],"Parts_inVehicle",1) setElementData(vehCol[thePlayer],"fuel",10000) end end addCommandHandler("carro", veiculodayz) não testei1 point
-
1 point
-
function veiculodayz(thePlayer) local accountname = getAccountName(getPlayerAccount(thePlayer)) if isObjectInACLGroup("user." .. accountname, aclGetGroup("Admin")) then if veh then DestroyElement(veh) DestroyElement(vehCol) end local x, y, z = getElementPosition(thePlayer) veh = createVehicle(411, x+3, y, z) setVehicleColor(veh,255,255,255) vehCol = createColSphere(x, y, z, 2.5) attachElements( vehCol, veh, 0, 0, 0 ) setElementData(vehCol,"parent",veh) setElementData(veh,"parent",vehCol) setElementData(vehCol,"vehicle",true) setElementData(vehCol,"Tire_inVehicle",4) setElementData(vehCol,"Engine_inVehicle",1) setElementData(vehCol,"Parts_inVehicle",1) setElementData(vehCol,"fuel",10000) end end addCommandHandler("carro", veiculodayz)1 point
-
1 point
-
1 point
-
Desculpa me meter, mas parece que a print que ele enviou não parece combinar com esse código, tem output's que não se encontram no código mas na print contém.1 point
-
1 point
-
Quando vc arrumar os erros do código atual, dai consigo te ajudar. A propósito, sua imagem é essa:1 point
-
Não funciona se for em outro resource. Os triggers só funcionam para scripts que estão no mesmo resource. Sim, está faltando os parâmetros de função. Caso não exista nenhum, deixe os parênteses vazios. exports["[VHR]Scr-Inventario"]:Abrir_Comidas() E também você deve adicionar isso no meta.xml: <export function="Abrir_Comidas" type="client"/> (supondo que a função a ser exportada seja client-side)1 point
-
1 point
-
Isso pode ser utilizado com TriggerEvent Aqui está um exemplo para entende-lo melhor. -- SERVER function AbrirPainel(source) triggerClientEvent(source,"Exemplo",source) -- Evento que será recebido do Client end addCommandHandler("Abrir", AbrirPainel) -- CLIENT function Abrir_C() outputChatBox ( "Aberto" ) end addEvent("Exemplo",true) addEventHandler("Exemplo",root,Abrir_C)1 point
-
Sim é possível. Basta você exportar as funções que abrem os painéis usando a função call. Dai você pode chamar essas funções exportadas em outros resources. Lembre-se que é necessário declarar as funções exportadas no meta.xml do resource que está exportando a função.1 point
-
1 point
-
accountname está sendo usado em outro script ou outra função? Se não estiver, deixe ela como variável local. Aquele do não faz sentido nenhum. Corrija a indentação do código. Existe um end em excesso.1 point
-
1 point
-
1 point
-
Desculpe estar deixando minha resposta como usuário do fórum bem atrasada, sou muito ocupado. Recomendo utilizar o recurso Slothbot.1 point
-
Como você tem total certeza que o script dele só tem o lado servidor? talvez possa ter o lado client também. <meta> <script src='NomeArquivoServer.lua'/> <script src='NomeArquivoClient.lua' type='client'/> </meta>1 point
-
1 point
-
دول ما لهم اسم محدد , تقدر تسميهم اي شي تباه ما دام ( ما دام انجليزي و ما فيه بعض الأشكال مثل , # - + ) الخ مثلا addEventHandler('onPlayerChat', root, function(m, mt) .... end ) m = message mt = message type1 point
-
1 point
-
Trigger a custom event from A to B (e.g. "onRequestAccountDetails") B handles the event, and calculates a return Trigger a custom event back from B to A with the return value along it (e.g. "onReceiveAccountDetails") A handles this as if it were a callback function You can make your life easier by writing a wrapper that handles this as if it was proper callbacks, keeping a table that maps requests to callback functions, and calls them when the returning event comes, along with the return value. The other option is coroutines, which, while being a lot more complicated, allow you to pause ("yield") the execution of a script until the return value arrives from the other end, and returns the value as a return of a simple call. This imitates a blocking function, which pauses execution of the Lua script (doesn't freeze the whole client) until the return is available, as opposed to the traditional use of asynchronous functions that work via callbacks. This is because events are asynchronous, meaning it takes quite a bit of time for the data to travel from the client to the server or vice versa, longer than the execution of one instruction - so you either have to pause execution, or end the function at some point and continue on in a callback handler function when the return is ready.1 point
-
A questão é você saber quando deve usar trigger e quando deve usar element-data. Na verdade set/getElementData é para o armazenamento no elemento, mas há ocasiões em que você pode usar o evento onClientElementDataChange (ou onElementDataChange) pra fazer um tipo de detecção entre os dois lados. O triggerClient/ServerEvent foi feito já pra isso, você chama um evento criado no outro lado, e dentro desse evento você faz um tipo de callback que retornará o valor (claro que um callback na programação não tem nada a ver com isso; usei no sentido de receber a chamada com um atraso).1 point
-
Usando elementData é o jeito mais fácil. No entanto outro jeito seria exportando funções de um script e importando em outro. Você pode fazer isso por meio da função call.1 point
-
Como você sabe que o problema está no uso de memória? Você chegou a fazer uma analise no código usando o performanceBrowser? É difícil de sabermos o que há de errado sem ter acesso ao código, mas o que posso dizer é que dependendo do que tiver rodando dentro de um onClientRender/PreRender pode afetar a performance do script a ponto de interromper a jogabilidade (como o network trouble que você mencionou). O acumulo de memória por conta de um código mal otimizado pode estar causando isso, embora também possa não ser essa a causa. Bom, antes de tudo, tenha certeza que todo o código esteja limpo e funcionando sem que dê problemas. Faça uma depuração, use o performanceBrowser como eu citei e aprenda a fazer os códigos de uma forma mais eficiente: https://springrts.com/wiki/Lua_Performance1 point
-
Eu costumo fazer o que eu chamo de two-wayTrigger: Vc faz um triggerClientEvent (ou server), dai no lado oposto vc obtém esse valor na função, e dentro dela já tem outro triggerServerEvent (ou client) que envia esse valor ao lado inicial.1 point
-
1 point
