SetMarcos Posted November 4, 2016 Share Posted November 4, 2016 Fala galera, necessito da ajuda de vocês... Vamos lá, esse script pega o player matou o outro, dá 200$ e duas estrelas, então eu quero fazer como está no código.... quando chegar a 6 estrelas ele é preso por 60 segundos e sendo setado pra uma prisão dps voltar pro msm lugar que ele tava ao chegar as 6 estrelas... Obrigado teste já... function StarKill ( ammo, killer, killerweapon, Vehicle, bodypart ) if ( killer ) and ( killer ~= source ) then x,y,z = getElementPosition(killer) local procurado = getPlayerWantedLevel (killer) if procurado == 0 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 2) elseif procurado == 2 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 4) elseif procurado == 4 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 6) elseif procurado == 6 then setPlayerWantedLevel (killer,0) removePedFromVehicle (killer) setElementPosition (killer, 2587.328125, 2067.626953125, 10.8203125) outputChatBox ("[PENITENCIÁRIA] - #ff0000Você foi preso por 60 segundos...",killer,80,80,80,true) outputChatBox ("[PENITENCIÁRIA] - " .. getPlayerName(killer) .. "#ff0000 foi preso por 60 segundos...",source,80,80,80,true) setElementFrozen (killer) setTimer (backlocation(killer) setElementPosition, 120000, 1) else givePlayerMoney ( killer, 200 ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), StarKill ) function backlocation (killer) setElementPosition (killer,x,y,z+1) end ~Marcos: Owner and Developer Fórum: http://infeczumbi.hol.es server IP: mtasa://198.100.158.105:22003 Link to comment
MrDante Posted November 5, 2016 Share Posted November 5, 2016 function StarKill ( ammo, killer, killerweapon, Vehicle, bodypart ) if ( killer ) and ( killer ~= source ) then x,y,z = getElementPosition(killer) setElementData(killer, "positions", {x, y, z}); local procurado = getPlayerWantedLevel (killer) if procurado == 0 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 2) elseif procurado == 2 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 4) elseif procurado == 4 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 6) elseif procurado == 6 then setPlayerWantedLevel (killer,0) removePedFromVehicle (killer) setElementPosition (killer, 2587.328125, 2067.626953125, 10.8203125) outputChatBox ("[PENITENCIÁRIA] - #ff0000Você foi preso por 60 segundos...",killer,80,80,80,true) outputChatBox ("[PENITENCIÁRIA] - " .. getPlayerName(killer) .. "#ff0000 foi preso por 60 segundos...",source,80,80,80,true) setElementFrozen (killer, true) setTimer (function () backlocation(killer) end, 120000, 1) else givePlayerMoney ( killer, 200 ) end end function backlocation (killer) local x, y, z = unpack(getElementData(killer, "positions")) setElementPosition (killer,x,y,z+1) end end addEventHandler ( "onPlayerWasted", getRootElement(), StarKill ) Link to comment
SetMarcos Posted November 6, 2016 Author Share Posted November 6, 2016 Uma dúvida que eu sempre tive... O setElementData salva o banco? On 05/11/2016 at 5:18 PM, MrDante said: function StarKill ( ammo, killer, killerweapon, Vehicle, bodypart ) if ( killer ) and ( killer ~= source ) then x,y,z = getElementPosition(killer) setElementData(killer, "positions", {x, y, z}); local procurado = getPlayerWantedLevel (killer) if procurado == 0 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 2) elseif procurado == 2 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 4) elseif procurado == 4 then givePlayerMoney ( killer, 200 ) setPlayerWantedLevel ( killer, 6) elseif procurado == 6 then setPlayerWantedLevel (killer,0) removePedFromVehicle (killer) setElementPosition (killer, 2587.328125, 2067.626953125, 10.8203125) outputChatBox ("[PENITENCIÁRIA] - #ff0000Você foi preso por 60 segundos...",killer,80,80,80,true) outputChatBox ("[PENITENCIÁRIA] - " .. getPlayerName(killer) .. "#ff0000 foi preso por 60 segundos...",source,80,80,80,true) setElementFrozen (killer, true) setTimer (function () backlocation(killer) end, 120000, 1) else givePlayerMoney ( killer, 200 ) end end function backlocation (killer) local x, y, z = unpack(getElementData(killer, "positions")) setElementPosition (killer,x,y,z+1) end end addEventHandler ( "onPlayerWasted", getRootElement(), StarKill ) vou testar aqui mano... Link to comment
MrDante Posted November 7, 2016 Share Posted November 7, 2016 Salva suas posições antes de ser preso. Link to comment
SetMarcos Posted November 9, 2016 Author Share Posted November 9, 2016 vlw cara... se precisar de mim, é só chamar Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now