Jump to content

Junim

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Junim's Achievements

Square

Square (6/54)

1

Reputation

  1. Junim

    "got vehicle"

    thank you very much guys! I going try
  2. Junim

    "got vehicle"

    WeaponCar = {}; Guard1 = {}; Guard2 = {}; addEventHandler("onResourceStart", root, function () StartTrajet (); end ) function StartTrajet () setTimer(function() if (isElement(WeaponCar) ) then destroyElement(WeaponCar); end if (isElement(Guard1) ) then destroyElement(Guard1); end if (isElement(Guard2) ) then destroyElement(Guard2); end WeaponCar = createVehicle(498, 1360, -1279, 14); Guard1 = createPed(73, 0, 0, 0); Guard2 = createPed(73, 0, 0, 0); warpPedIntoVehicle(Guard1, WeaponCar); warpPedIntoVehicle(Guard2, WeaponCar, 1); setElementRotation(WeaponCar, 0, 0, 1); setVehicleColor(WeaponCar, 0, 0, 0, 255); setControlState(WeaponCar, "accelerate", true); end, 1500, 1) end Hi guys, my problem is this "setControlState" my debugscript say "Expected player at argument 1, got vehicle" why he say this? what is the error in my code? Sorry my english I AM FROM BRAZIL ! I want that this vehicle accelerate alone , because i am doing an Artificial Inteligence "Traffic of vehicles". you can help me?
  3. local goals = {} local ball = {} addCommandHandler("fut", function ( player ) if (getElementData (player, "InGame") ) then return outputChatBox("#FF0000[FUTEBOL] #FFFFFFVocê já esta em campo ! (Digite /sairfut)", player, 255, 255, 255, true) end local posX, posY, posZ = getElementPosition( player ); goals = {createObject ( 16281, posX, posY+25, posZ+1, 0, 0, 180), --Gol 1 createObject ( 16281, posX, posY-25, posZ+1, 0, 0, -180) --Gol 2 }; --16052 \ 16281 ball = createObject ( 2114, posX, posY, posZ+2, 0, 0, 180) ; --Bola moveObject ( ball, 1000, posX, posY-0.5, posZ-0.8 ) local ballX, ballY, ballZ = getElementPosition( ball ); local dist = getDistanceBetweenPoints3D ( posX, posY, posZ, ballX, ballY, ballZ) outputChatBox("#FF0000[FUTEBOL] #FFFFFFVocê começou a jogar futebol !", player, 255, 255, 255, true); setElementData(player, "InGame", true) bindKey ( player, "lshift", "down", funcInput ) setTimer(function() if (dist > 2.1) then return end if (ball ~= nil) then attachElements ( ball, player, 0, 0.7, 0-0.8 ) end end, 2500, 0) end ) function funcInput ( player, key, keyState ) local state = "let go of" if ( keyState == "down" ) then state = "pressed" detachElements ( ball, player ) local xb,yb,zb = getElementPosition(player) local rxb,ryb,rzb = getElementRotation(player) local matrixs = (Matrix.create(xb,yb,zb, rxb,ryb,rzb)) local forward = (Matrix.getForward(matrixs) * 2) local positions = (Matrix.getPosition(matrixs) + forward) moveObject ( ball, 1000, positions.x, positions.y+25, positions.z-0.8) end end function destroyObjects () for i, v in ipairs(goals) do destroyElement(goals[i]); end if ball and isElement (ball) then destroyElement (ball) ball = nil end end addCommandHandler("sairfut", function ( player ) if (getElementData (player, "InGame") ) then destroyObjects (); outputChatBox("#FF0000[FUTEBOL] #FFFFFFVocê parou de jogar futebol !", player, 255, 255, 255, true); setElementData(player, "InGame", false) end end ) Guys, this is my soccer system. I have a problem, I'm trying to make when the player presses lshift he kicks the ball and the ball goes ahead of him, I tried a matrix code that I found here in the forum(line 39 at 43), but I could not make it work as I wanted it to work be! can you help me? if I was not clear sorry! and any English error forgive me I'm Brazilian.
  4. Hi guys, i have a question, How to set target on client-side? look my code please! -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- function getPlayerFromPartialName(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end function MultarPlayer(_,state) if ShowPanelMult == true then if state == "down" then if isCursorOnElement(x*896, y*388, x*98, y*36) then if playerName then local valor = guiGetText(ValorEdit); local motivo = guiGetText(MotivoEdit); local target = getPlayerFromPartialName(name) if (valor ~= "" and motivo ~= "") then if not tonumber(valor) then outputChatBox("#FFFF00[MULTA_SYSTEM] #FFFFFFNa caixa Valor digite apenas numeros.", 255, 255, 255, true) return end if target then if ShowMessage == false then ShowMessage = true; addEventHandler("onClientRender",target, Message) setTimer(function() ShowMessage = false; removeEventHandler("onClientRender",target, Message) end, 7000, 1) end end end else outputChatBox("#FFFF00[MULTA_SYSTEM] #FFFFFF Primeiro você precisa selecionar o nome de um jogador !",255,255,255,true) end end end end end addEventHandler("onClientClick",root,MultarPlayer) -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I wanted it to show the message that is in AddEventHandler for the other player (target) but I can not [SORRY MY ENGLISH I AM FROM BRAZIL]
  5. Yes, I tested and it worked! Thank you guy!
  6. This cancel the event when the player join in car. I take and continue with problem! But the player join the car same with mensage saying "you can't join the car"
  7. Ok, i will make a test and back with breaking news!
  8. This do not the player not enter in the vehicle?
  9. Hi guys, i have a problem with this code: --------------------------------------------------------------------------------------------------------------------------------------------------------- function JoinVehicleCar (player, seat) local acc = getAccountName(getPlayerAccount(player)) if seat == 0 then if (getElementModel(player) == "Automobile" or "Bike") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABCARMOTO"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end if (getElementModel(player) == "Helicopter" or "Plane") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABAERO"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end if (getElementModel(player) == "Boat") then if not (isObjectInACLGroup("user."..acc, aclGetGroup("HABBOAT"))) then cancelEvent() return outputChatBox("#000000[ #FFFF00CNH#000000 ] #FFFFFFVocê não possui #ff0000Habilitação #ffffff para conduzir este veiculo!",player,255,255,255, true) end end end end addEventHandler("onVehicleStartEnter",root,JoinVehicleCar) ------------------------------------------------------------------------------------------------------------------------- The problem is: When I am inside an ACL for example "HABCARMOTO" that would be only car and motorcycle, I can get into planes and boats too and I did not want this. And when I enter the ACL "HABAERO" or "HABBOAT" I can not get into any vehicle, why does this happen? SORRY MY ENGLISH, I AM FROM BRAZIL!
  10. Thanks, my problem was solve !
  11. Thanks, but how to solve it ?
×
×
  • Create New...