Jump to content

[AYUDA] con este resource


Recommended Posts

Necesito ayuda con esto

function taxiAmmu ( thePlayer, command ) 
  taxiBlip = createBlipAttachedTo ( thePlayer, 48, 1, 255, 0, 0, 0, 0, 99999.0, getRootElement() ) 
  outputChatBox ("Has llamado a un taxi.", thePlayer, 255, 190, 0, false ) 
  outputChatBox ("Alguien ha pedido un taxi", getRootElement(), 255, 190, 0, false ) 
end 
addEventHandler ("taxiAmmu", getRootElement(), taxiAmmu) 
  
function taxiCancelCommand ( thePlayer, command ) 
  outputChatBox ("Has cancelado el taxi.", thePlayer, 255, 190, 0, false ) 
  destroyElement ( taxiBlip ) 
end 
addCommandHandler ( "canceltaxi", taxiCancelCommand ) 
  
function betaaldeChaufeur(thePlayer, seat, jacked) 
  theVehicleID = getElementModel ( source ) 
  if (theVehicleID == 420) and ( seat ~= 0 ) then 
    driver = getVehicleOccupant(source, 0) 
    givePlayerMoney (driver, 50) 
    takePlayerMoney (thePlayer, 50) 
    outputChatBox ("El taxi cuesta 50", thePlayer) 
    destroyElement ( taxiBlip ) 
  end 
end 
addEventHandler ("onVehicleEnter", getRootElement(), betaaldeChaufeur)  

no me crea el blip especificado en la linea 2 dice que no existe el argumento...

Link to comment

En la funcion taxiAmmu

se supone que es un comando??? porq tus argumentos de funcion incluyen un command??

En caso contrario, si estas haciendo un trigger entonces estan mal tus argumentos de la funcion

y falta agregar addEventHanlder("taxiAmmu",taxiAmmu)

Link to comment
En la funcion taxiAmmu

se supone que es un comando??? porq tus argumentos de funcion incluyen un command??

En caso contrario, si estas haciendo un trigger entonces estan mal tus argumentos de la funcion

y falta agregar addEventHanlder("taxiAmmu",taxiAmmu)

No xD, no es un comando es por un botón y cuando lo presiono todo funciona bien excepto el createBlipAttachedTo

Link to comment

function taxiAmmu ( )

taxiBlip = createBlipAttachedTo (source, 48, 1, 255, 0, 0, 0, 0, 99999.0, getRootElement() )

outputChatBox ("Has llamado a un taxi.", source), 255, 190, 0, false )

outputChatBox ("Alguien ha pedido un taxi", getRootElement(), 255, 190, 0, false )

end

addEventHandler ("taxiAmmu", getRootElement(), taxiAmmu)

Link to comment

fail

Client side <--- esto anda perfecto pero por las dudas

GUIEditor_Label = {} 
  
theWindow = guiCreateWindow(8,136,149,220,"Telefono",false) 
guiWindowSetSizable(theWindow,false) 
guiSetVisible (theWindow, false) 
GUIEditor_Label[1] = guiCreateLabel(0.0671,0.1273,0.8255,0.0773,"Car",true,theWindow) 
guiLabelSetColor(GUIEditor_Label[1],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false) 
guiSetFont(GUIEditor_Label[1],"default-bold-small") 
spawnBut = guiCreateButton(0.0604,0.2227,0.4161,0.0955,"Spawn",true,theWindow) 
destroyBut = guiCreateButton(0.4966,0.2227,0.4161,0.0955,"Destroy",true,theWindow) 
fixBut = guiCreateButton(0.0604,0.3227,0.4161,0.0955,"Fix $50",true,theWindow) 
flipBut = guiCreateButton(0.5034,0.3227,0.4161,0.0955,"Flip",true,theWindow) 
GUIEditor_Label[2] = guiCreateLabel(0.0537,0.4409,0.8591,0.0773,"Taxi",true,theWindow) 
guiLabelSetColor(GUIEditor_Label[2],255,255,255) 
guiLabelSetVerticalAlign(GUIEditor_Label[2],"top") 
guiLabelSetHorizontalAlign(GUIEditor_Label[2],"left",false) 
guiSetFont(GUIEditor_Label[2],"default-bold-small") 
pirshipBut = guiCreateButton(0.0604,0.5273,0.8792,0.1,"Pirateship $25",true,theWindow) 
ammuBut = guiCreateButton(0.0604,0.6364,0.8792,0.1,"Ammunation $50",true,theWindow) 
carshopBut = guiCreateButton(0.0604,0.7455,0.8792,0.1,"Bank $50",true,theWindow) 
clothBut = guiCreateButton(0.0604,0.8545,0.8792,0.1,"Clothesshop $50",true,theWindow) 
  
function resourceStart () 
  bindKey ("m", "down", menuShow) 
end 
addEventHandler ("onClientResourceStart", getRootElement(), resourceStart) 
  
function menuShow () 
    visableornot = guiGetVisible (theWindow) 
    if (visableornot == true) then 
        guiSetVisible (theWindow, false) 
        showCursor (false) 
    end 
    if (visableornot == false) then 
        guiSetVisible (theWindow, true) 
        showCursor (true) 
    end 
end 
  
addEvent ("carSpawn", true) 
addEvent ("carDestroy", true) 
addEvent ("carFix", true) 
addEvent ("carFlip", true) 
addEvent ("taxiShip", true) 
addEvent ("taxiAmmu", true) 
addEvent ("taxiCar", true) 
addEvent ("taxiCloth", true) 
  
function guiClick (button, state, absoluteX, absoluteY) 
  if (source == spawnBut) then 
    triggerServerEvent ("carSpawn", getLocalPlayer()) 
  elseif (source == destroyBut) then 
    triggerServerEvent ("carDestroy", getLocalPlayer()) 
  elseif (source == fixBut) then 
    triggerServerEvent ("carFix", getLocalPlayer()) 
  elseif (source == flipBut) then 
    triggerServerEvent ("carFlip", getLocalPlayer()) 
  elseif (source == pirshipBut) then  
    triggerServerEvent ("taxiShip", getLocalPlayer()) 
  elseif (source == ammuBut) then 
    triggerServerEvent ("taxiAmmu", getLocalPlayer()) 
  elseif (source == carshopBut) then 
    triggerServerEvent ("taxiCar", getLocalPlayer()) 
  elseif (source == clothBut) then 
    triggerServerEvent ("taxiCloth", getLocalPlayer()) 
  end 
end 
addEventHandler ("onClientGUIClick", getRootElement(), guiClick) 

Server side, solamente el donde da error:

addEvent ("carSpawn", true) 
addEvent ("carDestroy", true) 
addEvent ("carFix", true) 
addEvent ("carFlip", true) 
addEvent ("taxiShip", true) 
addEvent ("taxiAmmu", true) 
addEvent ("taxiCar", true) 
addEvent ("taxiCloth", true) 
  
function taxiAmmu ( thePlayer, command ) 
  taxiBlip = createBlipAttachedTo ( thePlayer, 48, 1, 255, 0, 0, 0, 0, 99999.0, getRootElement() ) 
  outputChatBox ("Has llamado a un taxi.", thePlayer, 255, 190, 0, false ) 
  outputChatBox ("Alguien ha pedido un taxi", getRootElement(), 255, 190, 0, false ) 
end 
addEventHandler ("taxiAmmu", getRootElement(), taxiAmmu) 

El error se da en la onceava linea del script que esta arriba (server)

Link to comment
Saca los argumentos de la funcion taxiAmmu. Dentro de la funcion de taxiAmmu remplaza el argumento thePlayer por source.

Ahora si, perfecto ¿repito lo mismo con las demas funciones?

Correcto.

Link to comment

Ahora tengo problemas en el argumento "Driver"

function betaaldeChaufeur(thePlayer, seat, jacked) 
  theVehicleID = getElementModel ( source ) 
  if (theVehicleID == 420) and ( seat ~= 0 ) then 
    driver = getVehicleOccupant(source, 0) 
    givePlayerMoney (driver, 50) 
    outputChatBox ( "El usuario ha pagado", driver, 0, 255, 0, false ) 
    takePlayerMoney (thePlayer, 50) 
    outputChatBox ("El taxi cuesta 50", thePlayer) 
    destroyElement ( taxiBlip ) 
  end 
end 
addEventHandler ("onVehicleEnter", getRootElement(), betaaldeChaufeur)  

Tengo problemas en las lineas 5 y 6

PD: ¿también tengo que remplazar thePlayer por source?

Link to comment
  • Recently Browsing   0 members

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