Jump to content

Que esta mal en esto?


Plate

Recommended Posts

Posted

Hola tengo un problema con este script es que me dice attempt to perform arithmetic on local z (a nil valvue)

function hunter(player) 
local x, y, z = getElementPosition(player) 
hunter = createVehicle ( 425, x, y, z + 1) 
moveObject(hunter, 300, x, y, z + 30) 
setTimer ( destroyElement, 1500, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 
  

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted

Eso es porque 'player' esta mal, tiene que ser 'source' y no debe estar en el nombre de la funcion.

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
function hunter() 
local x, y, z = getElementPosition(source) 
hunter = createVehicle ( 425, x, y, z + 1) 
moveObject(hunter, 300, x, y, z + 30) --Object = Objeto ~ Elemento. En conclusion, no se movera 
setTimer ( destroyElement, 1500, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

Developer @ MYVAL

Posted

Alex entonces como hago para moverlo entonces alex

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
Alex entonces como hago para moverlo entonces alex

es Alexs, no Alex ni alex y para mover un hunter, quiza si lo attacheas a un objeto con el Alpha en 0 y mueves ese objeto sirva

Developer @ MYVAL

Posted

Con

attachElements 

PD: en el mta me llamo TimY y todos me dicen tomy acostumbrate que digan mal tu nombre jaja yo ya me rendi de tratar de corregirlos para que lo digan bien

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
function hunter() 
local x, y, z = getElementPosition(source) 
local x2, y2, z2 = getElementPosition(hunter) 
setElementAlpha(cosa, 0) 
cosa = createObject(1000, x2, y2, z2) 
attachtElements(cosa, hunter, 0, 0, 2) 
hunter = createVehicle ( 425, x, y, z + 1) 
moveObject(cosa, 2, x, y, z + 30) -- lo podes corregir esto para que se mueva lento por que nose como se hace  
setTimer ( destroyElement, 1500, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
function hunter() 
local x, y, z = getElementPosition(source) 
local x2, y2, z2 = getElementPosition(hunter) 
setElementAlpha(cosa, 0) 
cosa = createObject(1000, x2, y2, z2) 
attachtElements(cosa, hunter, 0, 0, 2) 
hunter = createVehicle ( 425, x, y, z + 1) 
moveObject(cosa, 2, x, y, z + 30) -- lo podes corregir esto para que se mueva lento por que nose como se hace  
setTimer ( destroyElement, 1500, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

function hunter() 
cosa = createObject(1000, x2, y2, z2) --Lo habias creado despues de usarlo 
hunter = createVehicle ( 425, x, y, z + 1)  --Lo habias creado despues de usarlo 
local x, y, z = getElementPosition(source) 
local x2, y2, z2 = getElementPosition(hunter) 
setElementAlpha(cosa, 0) 
attachElements(cosa, hunter, 0, 0, 2) -- Usaste una "T" de mas 
moveObject(cosa, 20000, x, y, z + 30) -- Deberia moverse en 2 segundos 
setTimer ( destroyElement, 20001, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

Developer @ MYVAL

Posted
Hunter/Hunter_s.lua:2:BadArgument @ "createObject"[expected number at argument 2, got nil] 
Hunter/Hunter_s.lua:3: attempt to perform aritmetic on global z 

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
  
function hunter() 
local sx, sy, sz = getElementPosition(source) 
hunter = createVehicle ( 425, sx, sy, sz + 1)   
local x2, y2, z2 = getElementPosition(hunter) 
cosa = createObject(1000, x2, y2, z2)  
setElementAlpha(cosa, 0) 
attachElements(cosa, hunter, 0, 0, 2)  
moveObject(cosa, 20000, x, y, z + 30)  
setTimer ( destroyElement, 20001, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

Developer @ MYVAL

Posted

me sigue diciendo algo de BadArgument en eso de la z

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

Posted
function hunter() 
local sx,sy,sz = getElementPosition(source) 
hunter = createVehicle ( 425, sx, sy, sz + 1)   
local x2,y2,z2 = getElementPosition(hunter) 
cosa = createObject(1000, x2, y2, z2)  
setElementAlpha(cosa, 0) 
attachElements(cosa, hunter, 0, 0, 2)  
moveObject(cosa, 20000, sx, sy, sz + 30)  
setTimer ( destroyElement, 20001, 1, hunter ) 
end 
addEventHandler("onPlayerSpawn",getRootElement(),hunter) 

Proba asi

Developer @ MYVAL

Posted (edited)

El elemento es 'cosa' u.u

hunter = createVehicle ( 425, x, y, z )  
local x,y,z = getElementPosition( hunter )  --para obtener la posicion del hunter 
setTimer ( destroyElement, 3000, 1, hunter ) 
  

probalo asi.

Edited by Guest

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

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

Posted

Yo pienso que esta al el getElementPosition(hunter)

Visita Full GameZ DayZ Mod

Server IP: mtasa://158.69.125.144:29015

  • Recently Browsing   0 members

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