Plate Posted August 5, 2012 Share Posted August 5, 2012 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) Link to comment
Castillo Posted August 5, 2012 Share Posted August 5, 2012 Eso es porque 'player' esta mal, tiene que ser 'source' y no debe estar en el nombre de la funcion. Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 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) Link to comment
Plate Posted August 5, 2012 Author Share Posted August 5, 2012 Alex entonces como hago para moverlo entonces alex Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 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 Link to comment
Plate Posted August 5, 2012 Author Share Posted August 5, 2012 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 Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 convenci a mis users de nombrarme bien, usa: createVehicle createObject attachElements setElementAlpha moveObject Link to comment
Plate Posted August 5, 2012 Author Share Posted August 5, 2012 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) Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 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) Link to comment
Plate Posted August 5, 2012 Author Share Posted August 5, 2012 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 Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 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) Link to comment
Plate Posted August 5, 2012 Author Share Posted August 5, 2012 me sigue diciendo algo de BadArgument en eso de la z Link to comment
Alexs Posted August 5, 2012 Share Posted August 5, 2012 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 Link to comment
Plate Posted August 6, 2012 Author Share Posted August 6, 2012 Ahora no se destruye el hunter Link to comment
NodZen Posted August 6, 2012 Share Posted August 6, 2012 (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 August 6, 2012 by Guest Link to comment
NodZen Posted August 6, 2012 Share Posted August 6, 2012 El elemento es 'cosa' u.uCreo que està mal esto moveObject(cosa, 20000, sx, sy, sz + 30) Talvez moveObject(hunter, 20000, sx, sy, sz + 30) Link to comment
Plate Posted August 6, 2012 Author Share Posted August 6, 2012 Yo pienso que esta al el getElementPosition(hunter) Link to comment
Recommended Posts