Jump to content

2 Dudas


Soren

Recommended Posts

1 Duda:

Quiero un hacer un script donde si eres de un team en este caso Alien y mueras aparescas en un lugar especifico. y si eres humano en otro lugar

2 Duda:

Hice el script de First Person shooter en commando pero quiero usar el mismo commando para usarlo y desactivarlo:

function FPSStop (startedresource) 
    if startedresource == getThisResource() then 
        setElementAlpha( getLocalPlayer(), 255) 
        setCameraTarget (getLocalPlayer())       
    end 
end 
addEventHandler ( "onClientResourceStop", getRootElement(), FPSStop) 
  
function shakeCamera(weapon) 
    x,y,z = getPedBonePosition ( getLocalPlayer(), 26 ) 
    if weapon == 24  then  
        createExplosion ( x,y,z + 10,12,false,0.4,false) 
    elseif weapon == 25  then  
        createExplosion ( x,y,z + 10,12,false,0.5,false) 
    elseif weapon == 26  then 
        createExplosion ( x,y,z + 10,12,false,0.7,false) 
    elseif weapon == 27  then  
        createExplosion ( x,y,z + 10,12,false,0.5,false) 
    elseif weapon == 29  then  
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 30  then  
        createExplosion ( x,y,z+10,12,false,0.2,false) 
    elseif weapon == 31  then  
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 33  then  
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 34  then  
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 22  then  
        createExplosion ( x,y,z + 10,12,false,0.1,false) 
    elseif weapon == 28  then  
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 32  then  
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 38  then  
        createExplosion ( x,y,z + 10,12,false,0.6,false) 
    end 
end 
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera ) 
  
function carcheck(player) 
    if player == getLocalPlayer() then 
        abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) 
        setElementCollisionsEnabled(Body, false) 
        setElementAlpha(getLocalPlayer(), 255) 
    end 
end 
addEventHandler ( "onClientVehicleStartEnter", getRootElement(), carcheck ) 
  
function checkCarTask() 
    local stask = getPedSimplestTask(getLocalPlayer())  
    if (stask == "TASK_SIMPLE_CAR_GET_IN") or (stask == "TASK_SIMPLE_GO_TO_POINT") or (stask == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE") or (stask == "TASK_SIMPLE_CAR_ALIGN") or (stask == "TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE") or (stask == "TASK_SIMPLE_CAR_SHUFFLE") or (stask == "TASK_SIMPLE_CAR_DRIVE") or (stask == "TASK_SIMPLE_ACHIEVE_HEADING") then 
        abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) 
    elseif (isPedInVehicle(getLocalPlayer()) == false) then 
--enter vehicle was aborted 
        setElementCollisionsEnabled(Body, true) 
        setElementAlpha(getLocalPlayer(), 0) 
    end 
end 
  
function carexit(player) 
    if player == getLocalPlayer() then 
        setElementCollisionsEnabled(Body, true) 
        setElementAlpha(getLocalPlayer(), 0) 
    end 
end 
addEventHandler ( "onClientVehicleExit", getRootElement(), carexit ) 
  
    addCommandHandler( "fps" FPSStart, true ) 
      else 
    addCommandHandler( "fps" FPSStart, false ) 
end 

ayudenme pls

Link to comment

1):

local alienX, alienY, alienZ = 0, 0, 5 
local humanX, humanY, humanZ = 0, 0, 10 
  
addEventHandler("onPlayerWasted",root, 
    function () 
        if (getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) == "Alien") then 
            setTimer(spawnPlayer, 1000, 1, source, alienX, alienY, alienZ) 
        elseif (getPlayerTeam(source) and getTeamName(getPlayerTeam(source)) == "Human") then 
            setTimer(spawnPlayer, 1000, 1, source, humanX, humanY, humanZ) 
        end 
    end 
) 

2):

function FPSStop () 
    if isElement(Body) then destroyElement(Body) end 
    setElementAlpha( getLocalPlayer(), 255) 
    setCameraTarget (getLocalPlayer()) 
end 
addEventHandler ( "onClientResourceStop", resourceRoot, FPSStop) 
  
function shakeCamera(weapon) 
    x,y,z = getPedBonePosition ( getLocalPlayer(), 26 ) 
    if weapon == 24  then 
        createExplosion ( x,y,z + 10,12,false,0.4,false) 
    elseif weapon == 25  then 
        createExplosion ( x,y,z + 10,12,false,0.5,false) 
    elseif weapon == 26  then 
        createExplosion ( x,y,z + 10,12,false,0.7,false) 
    elseif weapon == 27  then 
        createExplosion ( x,y,z + 10,12,false,0.5,false) 
    elseif weapon == 29  then 
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 30  then 
        createExplosion ( x,y,z+10,12,false,0.2,false) 
    elseif weapon == 31  then 
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 33  then 
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 34  then 
        createExplosion ( x,y,z + 10,12,false,0.3,false) 
    elseif weapon == 22  then 
        createExplosion ( x,y,z + 10,12,false,0.1,false) 
    elseif weapon == 28  then 
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 32  then 
        createExplosion ( x,y,z + 10,12,false,0.2,false) 
    elseif weapon == 38  then 
        createExplosion ( x,y,z + 10,12,false,0.6,false) 
    end 
end 
addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), shakeCamera ) 
  
function carcheck(player) 
    if player == getLocalPlayer() then 
        abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) 
        setElementCollisionsEnabled(Body, false) 
        setElementAlpha(getLocalPlayer(), 255) 
    end 
end 
addEventHandler ( "onClientVehicleStartEnter", getRootElement(), carcheck ) 
  
function checkCarTask() 
    local stask = getPedSimplestTask(getLocalPlayer()) 
    if (stask == "TASK_SIMPLE_CAR_GET_IN") or (stask == "TASK_SIMPLE_GO_TO_POINT") or (stask == "TASK_SIMPLE_CAR_OPEN_DOOR_FROM_OUTSIDE") or (stask == "TASK_SIMPLE_CAR_ALIGN") or (stask == "TASK_SIMPLE_CAR_CLOSE_DOOR_FROM_INSIDE") or (stask == "TASK_SIMPLE_CAR_SHUFFLE") or (stask == "TASK_SIMPLE_CAR_DRIVE") or (stask == "TASK_SIMPLE_ACHIEVE_HEADING") then 
        abortCarEnterCheck = setTimer ( checkCarTask, 100, 1 ) 
    elseif (isPedInVehicle(getLocalPlayer()) == false) then 
        --enter vehicle was aborted 
        setElementCollisionsEnabled(Body, true) 
        setElementAlpha(getLocalPlayer(), 0) 
    end 
end 
  
function carexit(player) 
    if player == getLocalPlayer() then 
        setElementCollisionsEnabled(Body, true) 
        setElementAlpha(getLocalPlayer(), 0) 
    end 
end 
addEventHandler ( "onClientVehicleExit", getRootElement(), carexit ) 
  
function FPSStart () 
    if (not isElement(Body)) then 
        local x,y,z = getElementPosition( getLocalPlayer() ) 
        Body = createObject (983, x, y, z ) 
        attachElements ( Body, getLocalPlayer(), 0, -0.1, 0.45, 90, 0, 90) 
        setElementAlpha( Body, 0) 
        setTimer ( setElementAlpha,1000, 1, getLocalPlayer(), 0) 
    else 
        FPSStop() 
    end 
end 
addCommandHandler( "fps", FPSStart ) 

Link to comment
Le faltaba la coma en addCommandHandler, copia el script de nuevo.

P.D: No eras vos el que habia dejado el MTA?

Que incomodo :S me descubriste xD sigo trabajando en mi gamemode. Aveces me conecto para jugar pero no soy tan activo como antes.

Edit: El primer script no me funciono :S

Link to comment
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...