Flipi Posted August 18, 2013 Share Posted August 18, 2013 Quisiera saber como hacer para bloquear y desbloquear los vehículos desde el exterior, porque el que tengo solo se puede desde el interior y al salirse del vehiculo se desbloquea. function lockCar(playerSource) local carID = getPedOccupiedVehicle(playerSource) if (carID) and (isVehicleLocked(carID)) and (getVehicleOccupant(carID) == playerSource) then local unlocked = setVehicleLocked(carID, false) if (unlocked) then outputChatBox("#0080FFTu " .. getVehicleName(carID) .. " #0080FFesta desbloqueado!", playerSource, 255, 255, 255, true) else outputChatBox("#0080FFTu " .. getVehicleName(carID) .. " #0080FFno se pudo desbloquear!", playerSource, 255, 255, 255, true) end elseif not (carID) then elseif not (isVehicleLocked(carID)) and (getVehicleOccupant(carID) == playerSource) then local locked = setVehicleLocked(carID, true) if (locked) then outputChatBox("#0080FFTu " .. getVehicleName(carID) .. " #0080FFesta bloqueado!", playerSource, 255, 255, 255, true) else outputChatBox("#0080FFTu " .. getVehicleName(carID) .. " #0080FFno se pudo bloquear!", playerSource, 255, 255, 255, true) end end end function unlockOnExit(thePlayer, seat, jacker) if (seat == 0) and (thePlayer) and (isVehicleLocked(source)) then local unlocked = setVehicleLocked(source, false) if (unlocked) then outputChatBox("#0080FFTu " .. getVehicleName(source) .. " #0080FFesta desbloqueado!", thePlayer, 255, 255, 255, true) end end end addEventHandler("onVehicleExit", getRootElement(), unlockOnExit) addEventHandler("onPlayerJoin",root,function() bindKey(source,"o", "down", lockCar) end) function onStart() for id, players in ipairs(getElementsByType("player")) do bindKey(players ,"o", "down", lockCar) end end Link to comment
Castillo Posted August 18, 2013 Share Posted August 18, 2013 Podrias crear un colshape temporario para obtener los vehiculos dentro de el. Link to comment
Flipi Posted August 18, 2013 Author Share Posted August 18, 2013 Podrias crear un colshape temporario para obtener los vehiculos dentro de el. Una consulta nada que ver con el tema, tengo otro script donde haces respawn en el lugar que mueres, pero revives con el skin default de CJ, como puedo hacer que reviva con el skin que murio (current skin)? addEventHandler("onPlayerWasted", getRootElement(), function() local x, y, z = getElementPosition(source) spawnPlayer ( source, x, y, z ) end Link to comment
Castillo Posted August 18, 2013 Share Posted August 18, 2013 Obtene el skin del jugador y daselo al spawnear. Link to comment
Arsilex Posted August 18, 2013 Share Posted August 18, 2013 addEventHandler("onPlayerWasted", getRootElement(), function() local x, y, z = getElementPosition(source) m = getElementModel(source) spawnPlayer ( source, x, y, z, 180, m ) end Link to comment
Recommended Posts