Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/10/19 in all areas

  1. I din't know that i can store with this method local pos = {getElementPosition(source)} Thanks for help me ?
    1 point
  2. Creating a new table is a slower method, but nothing to worry about. You wouldn't notice the difference with the computers these days. You didn't need the pack function to do this: local pos = {getElementPosition(source)} But if it helps you with readability, then why not a pack function?
    1 point
  3. Thanks so much @IIYAMA is good way! what you think about this method? is bad practice? i still learning function pack(...) return {...} end pos = pack(getElementPosition(source)) playerData = { x = pos[1], y = pos[2], z = pos[3] }
    1 point
  4. ----- WHERE U SET THE CAR owner if u have a vehicle spawner or what trigger that event with vehicle ID addEvent("onPlayerSpawnVehicle",true) addEventHandler("onPlayerSpawnVehicle",root,function(ID,X,Y,Z,ROT) veh = createVehicle(ID,X,Y,Z,ROT) setElementData(veh, "Owned", "yes") setElementData(veh, "Owner", getAccountName(getPlayerAccount(source))) addEventHandler("onVehicleExplode", veh, function() if getElementData(source, "Owned") == "yes" then outputChatBox("Vehicles: Your vehicle has been has destroyed",getElementData(source,"Owner") ,0,0,0) end end) end)
    1 point
  5. function checkwater() if(isPedDoingTask(localPlayer, "TASK_COMPLEX_IN_WATER")) then setElementHealth(localPlayer, getElementHealth(localPlayer)-0.5) end end addEventHandler("onClientPreRender", root, checkwater) in client
    1 point
  6. local x, y, z = getElementPosition(source) local xr, yr, zr = getElementRotation(source) local playerData = {x=x, y=y, z=z, xr=xr, yr=yr, zr=zr} Those 2 functions do not return a table, but multiple variables.
    1 point
  7. Fiz o seguinte teste está funcionando normalmente: client.Lua: addEventHandler ("onClientKey", root, function (key, state) -- Troquei source por state. Eles não são a mesma coisa. if key == "backspace" and state then -- Se a tecla apertada for backspace (apenas para teste) e estiver sendo pressionada, então: triggerServerEvent ("onClientBuyVehicle", localPlayer) -- Os demais parâmetros não coloquei pois precisaria do resto do script, mas não creio que exista problema neles. Removi também o primeiro localPlayer (vc estava usando 2 sem necessidade). end end) server.Lua: addEvent("onClientBuyVehicle", true) addEventHandler("onClientBuyVehicle", root, function(model, price, r, g, b, r1, g1, b1) -- Todos esses parâmetros são nil, pois não declarei eles no trigger, mas ignorei pois nem estou usando no teste. Também não estou mais usando playerSource, pois ele já é passado automaticamente pela variável predefinida client. Também funcionaria com source, pois passei o localPlayer como source no triggerServerEvent. outputChatBox("[Brasil PH]: #ffffffLembre-se de estacionar seu veiculo para que ele seja salvo em nosso sistema", client, 65, 105, 225, true) -- Usei client, mas funcionaria com source também. Também removi o código #hex no início do texto e coloquei direto nos parâmetros RGB para otimização. end)
    1 point
  8. Bem estranho... o evento está adicionado sim no lado server. Não era pra dar esse erro. Farei alguns testes com server local.
    1 point
  9. Vale lembrar que não damos suporte para scripts roubados/vazados.
    1 point
  10. Se o script for pego da internet, não tem motivo para protegê-lo, uma vez que qualquer um poderia pegá-lo de lá. Mas se você comprou o script (e ele não é vazado de outro lugar) ou você mesmo desenvolveu, você pode mandá-lo via mensagem privada, em vez de publicá-lo aqui.
    1 point
  11. Falta o evento "onClientBuyVehicle" no script server-side. Mostre como estão os scripts client.Lua e server.Lua do seu resource de concessionária.
    1 point
  12. Оказывается, все это время проблема была именно в версии сервера. На хостинге во время переустановки накатывалась r16xxx версия, а я не обратил на это внимания. Спасибо за помощь!
    1 point
×
×
  • Create New...