iFoReX Posted May 11, 2012 Share Posted May 11, 2012 podria ser con setElementDimension y haces una tabla con las dimenciones que quieres y le pones un math random al setElementDimension Link to comment
Castillo Posted May 11, 2012 Share Posted May 11, 2012 @mauro: Yo sabia que ivas a tener ese problema, podes usar una funcion que yo cree para que puedas obtener una dimension que no este usada. function getFreeDimension ( ) local dim = 0 local tempTable = { } for index, player in ipairs ( getElementsByType ( "player" ) ) do tempTable [ getElementDimension ( player ) ] = true end repeat dim = dim + 1 until not tempTable [ dim ] return tonumber ( dim ) end La cosa es que yo la uso server side, no se si va a funcionar bien client side. Link to comment
maauroo Posted May 12, 2012 Author Share Posted May 12, 2012 Mira Puse Esto: function camf() if (client) then setElementPosition( client,98.5163, 2246.3232, 125.1528 ) local rot = setPedRotation(client, 1) setCameraMatrix( client, 95.1860, 2239.7947, 126.7486, 98.5163, 2246.3232, 125.1528) end end addEvent("FrontCamera", true) addEventHandler("FrontCamera", getRootElement(), camf) function getFreeDimension ( ) local dim = 0 local tempTable = { } for index, player in ipairs ( getElementsByType ( "player" ) ) do tempTable [ getElementDimension ( player ) ] = true end repeat dim = dim + 1 until not tempTable [ dim ] return tonumber ( dim ) end function selected() if (client) then fadeCamera(client, true) setCameraTarget(client, client) setElementDimension ( client, 0 ) local skin = getElementModel ( client ) spawnPlayer(client, -2026.5035, 156.7506, 29.0391, 269.1424, skin) outputChatBox("Skin successfully changed!", client) end end addEvent("SkinSelected", true) addEventHandler("SkinSelected", getRootElement(), selected) function skinright() local skin = getPedSkin(client) if (client) then if (skin == 0) then setPedSkin(client, 7) elseif (skin == 7) then setPedSkin(client, 9) elseif (skin == 41) then setPedSkin(client, 43) elseif (skin == 64) then setPedSkin(client, 66) elseif (skin == 85) then setPedSkin(client, 87) elseif(skin == 118) then setPedSkin(client, 120) elseif(skin == 148) then setPedSkin(client, 150) elseif(skin == 207) then setPedSkin(client, 209) elseif(skin == 238) then setPedSkin(client, 240) elseif(skin == 264) then setPedSkin(client, 274) elseif(skin == 288) then setPedSkin(client, 0) else setPedSkin(client, skin+1) end end end addEvent("SkinRight", true) addEventHandler("SkinRight", getRootElement(), skinright ) function skinleft() local skin = getPedSkin(client) if (client) then if (skin == 7) then setPedSkin(client, 0) elseif (skin == 9) then setPedSkin(client, 7) elseif (skin == 43) then setPedSkin(client, 41) elseif (skin == 66) then setPedSkin(client, 64) elseif (skin == 87) then setPedSkin(client, 85) elseif(skin == 120) then setPedSkin(client, 118) elseif(skin == 150) then setPedSkin(client, 148) elseif(skin == 209) then setPedSkin(client, 207) elseif(skin == 240) then setPedSkin(client, 238) elseif(skin == 274) then setPedSkin(client, 264) elseif(skin == 0) then setPedSkin(client, 288) else setPedSkin(client, skin-1) end end end addEvent("SkinLeft", true) addEventHandler("SkinLeft", getRootElement(), skinleft) Pero No Funciona.. ¿Hay Solucion? ¿Cual Es El Problema? Link to comment
Castillo Posted May 12, 2012 Share Posted May 12, 2012 Yo no veo donde usas la funcion que te di ( getFreeDimension ). Link to comment
maauroo Posted May 12, 2012 Author Share Posted May 12, 2012 Fijate.. Te Lo Marque. function camf() if (client) then setElementPosition( client,98.5163, 2246.3232, 125.1528 ) local rot = setPedRotation(client, 1) setCameraMatrix( client, 95.1860, 2239.7947, 126.7486, 98.5163, 2246.3232, 125.1528) end end addEvent("FrontCamera", true) addEventHandler("FrontCamera", getRootElement(), camf) ------------------------------------------------------------------ function getFreeDimension ( ) local dim = 0 local tempTable = { } for index, player in ipairs ( getElementsByType ( "player" ) ) do tempTable [ getElementDimension ( player ) ] = true ----------AQUI Esta. end repeat dim = dim + 1 until not tempTable [ dim ] return tonumber ( dim ) end ------------------------------------------------------------------------ function selected() if (client) then fadeCamera(client, true) setCameraTarget(client, client) setElementDimension ( client, 0 ) local skin = getElementModel ( client ) spawnPlayer(client, -2026.5035, 156.7506, 29.0391, 269.1424, skin) outputChatBox("Skin successfully changed!", client) end end addEvent("SkinSelected", true) addEventHandler("SkinSelected", getRootElement(), selected) ¿ Como Puedo Solucionarlo? Link to comment
Castillo Posted May 12, 2012 Share Posted May 12, 2012 Me parece que no entendiste como funciona, lo que marcaste no tiene sentido, la funcion devuelve un numero que no este siendo usado por otro jugador. Seria asi: local dimension = getFreeDimension ( ) setElementDimension ( elJugador, dimension ) Link to comment
maauroo Posted May 12, 2012 Author Share Posted May 12, 2012 Lo Puse Todo Pero No Funciona Las Otras Funciones. La De La Camara y No Puedo Cambiar Skin.. ¿Que Problema Hay? Link to comment
Recommended Posts