Jump to content

Duda con 1 Script


Alexs

Recommended Posts

Posted

Hola a Todos, un amigo me pidio que lo ayudara con esto pero no se ni que tiene mal por que no me dijo y se fue, lo intente arreglar y nada :S

Server

createBlip ( 2799, -2495, 13, 62 ) 
  
function createSpartanTeam () 
    SpartanTeam = createTeam ("Spartan", 6, 183, 248) 
end 
addEventHandler ("onResourceStart", resourceRoot, createSpartanTeam) 
  
function joinSpartan() 
     setPlayerTeam(source,SpartanTeam) 
     setElementModel(source,103) 
      giveWeapon ( source, 20, 300 ) 
     setElementData( source, "Occupation", "Spartan", true ) 
     outputChatBox("Ahora eres un Spartan",source,0,255,0) 
end 
addEvent("setSpartan", true) 
addEventHandler("setSpartan",root,joinSpartan) 
addEvent("spartan:healing", true) 
addEventHandler("spartan:healing", root, 
function (spartan) 
    if (getElementHealth(source) < 100) then 
        local Heal = getElementHealth(source) + 10 -- New health 
        setElementHealth(source, Heal)  
        if (Heal > 100) then 
             setElementHealth(source, 100) 
        end 
        givePlayerMoney(spartan, 100) -- Gives 100$ to the medic each time the function is executed 
        takePlayerMoney(source, 100) -- Takes 100$ from the source when he get healed 
    end 
end) 

Client

MarcadosDos = createmarker( 2799, -2495, 13, "Cylinder", 2, 6, 183, 248, 153) 
  
  
GUIEditor_Button = {} 
    GUIEditor_Memo = {} 
    GUIEditor_Label = {} 
      
    function guiMyCwindow(w,h,t) 
      local x,y = guiGetScreenSize() 
      return guiCreateWindow((x-w)/2,(y-h)/2,w,h,t,false) 
    end 
      
    windowjob = guiMyCwindow(301,250,"Spartan job") 
    guiSetVisible(windowjob, false) 
    GUIEditor_Button[1] = guiCreateButton(22,200,108,35,"Unirme",false,windowjob) 
    GUIEditor_Label[1] = guiCreateLabel(193,-103,5,5,"",false,windowjob) 
    GUIEditor_Button[2] = guiCreateButton(179,200,110,36,"Cancelar",false,windowjob) 
    GUIEditor_Memo[1] = guiCreateMemo(19,33,273,100,"Si deseas unirte a los Spartanos dale en Unirme",false,windowjob) 
     guiEditSetReadOnly(GUIEditor_Memo[1],true) 
      
    function Spartanjob(hitElement) 
         if getElementType(hitElement) == "player" and (hitElement == localPlayer) then 
              if not guiGetVisible(windowjob) then 
                   guiSetVisible(windowjob, true) 
                   showCursor(true) 
              end 
         end 
    end 
    addEventHandler("onClientMarkerHit", MarcadosDos, Spartanjob) 
      
    function Spartanjobleave(leaveElement) 
         if getElementType(leaveElement) == "player" and (leaveElement == localPlayer) then 
              if guiGetVisible(windowjob) then 
                   guiSetVisible(windowjob, false) 
                   showCursor(false) 
              end 
         end 
    end 
    addEventHandler("onClientMarkerLeave", MarcadosDos, Spartanjobleave) 
      
    function joinTeam() 
         triggerServerEvent("setSpartan",localPlayer) 
         guiSetVisible(windowjob, false) 
         showCursor(false) 
    end 
    addEventHandler("onClientGUIClick", GUIEditor_Button[1] , joinTeam, false) 
      
    function removeSpartanWindow() 
         guiSetVisible(windowjob, false) 
         showCursor(false) 
    end 
    addEventHandler("onClientGUIClick", GUIEditor_Button[2] , removeSpartanWindow, false) 
    addEventHandler("onClientPlayerDamage", localPlayer, 

Developer @ MYVAL

Posted

El primer error que veo es que puso: createmarker, "marker" con "M" minuscula.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Si, con eso dice que ya se puede encargar el, pero aprovechando el hilo, sabes que esta mal con esto?

function checkjourney( res ) 
idvehiculo = getElementByID("Journey1") 
markador = createMarker(182.19999694824, -93.400001525879, 546.20001220703, 'cylinder', 1.0, 0, 0, 255, 155) 
setElementInterior ( markador, 15 ) 
   end 
addEventHandler ( "onResourceStart", getRootElement(), checkjourney ) 
  
function journeyin( thePlayer, seat, jacked ) 
idjourney = getElementID ( source ) 
    if (id == Journey1) and (seat ~= 0) then 
setElementPosition(thePlayer, 182.19999694824, -93.400001525879, 546.20001220703) 
setElementInterior(thePlayer, 15) 
setElementDimension(thePlayer, 0) 
   end 
end 
addEventHandler ( "onVehicleEnter", getRootElement(), journeyin ) 
  
function journeyout( hitElement, matchingDimension ) 
local vx,vy,vz = getElementPosition( idvehiculo ) 
setElementPosition ( hitElement, vx,vy + 2,vz) 
   end 
end 
addEventHandler( "onMarkerHit", markador, journeyout ) 

Developer @ MYVAL

Posted
function checkjourney ( ) 
    idvehiculo = getElementByID ( "Journey1" ) 
    addEventHandler ( "onVehicleEnter", idvehiculo, journeyin ) 
    markador = createMarker ( 182.19999694824, -93.400001525879, 546.20001220703, 'cylinder', 1.0, 0, 0, 255, 155 ) 
    setElementInterior ( markador, 15 ) 
    addEventHandler ( "onMarkerHit", markador, journeyout ) 
end 
addEventHandler ( "onResourceStart", resourceRoot, checkjourney ) 
  
function journeyin( thePlayer, seat, jacked ) 
    if ( seat ~= 0 ) then 
        setElementPosition ( thePlayer, 182.19999694824, -93.400001525879, 546.20001220703 ) 
        setElementInterior ( thePlayer, 15 ) 
        setElementDimension ( thePlayer, 0 ) 
    end 
end 
  
function journeyout ( hitElement, matchingDimension ) 
    local vx, vy, vz = getElementPosition ( idvehiculo ) 
    setElementPosition ( hitElement, vx, vy + 2,vz ) 
end 

Tus errores:

1: Estabas intentando comparar el ID del vehiculo con Journey1, sin comillas.

2: Pusiste el event handler del marker antes de ser creado.

3: Tenias un 'end' de mas en la funcion: "journeyout".

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Tengo 2 Problemas:

Me mueve con vehiculo y todo al Map

El Mapa (en el interior 15) es invisible

Como lo arreglo?

Intente con:

addEventHandler ( "onVehicleEnter", getRootElement(), journeyin ) 

pero queda igual

Developer @ MYVAL

Posted
Tengo 2 Problemas:

Me mueve con vehiculo y todo al Map

El Mapa (en el interior 15) es invisible

Como lo arreglo?

Intente con:

addEventHandler ( "onVehicleEnter", getRootElement(), journeyin ) 

pero queda igual

Amigo , pusiste el SetElementInterior en el Server o client? ademas que yo sepa , no va (thePlayer)

podes editar este

setElementInterior(pedammusf,6) 

------------------------------------------------------------------------------------------

My scripts

http://community.multitheftauto.com/index.php?p=resources&s=details&id=6977

http://community.multitheftauto.com/index.php?p=resources&s=details&id=7740

  • Recently Browsing   0 members

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