Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function predBomb( player, _,name, meters )
- local target = getPlayerFromPartialName ( name,player )
- if not isElement ( target ) then return outputChatBox( "can't find player" ) end
- local meters = tonumber( meters )
- if not meters then
- meters = 3
- end
- local posX , posY , posZ = getElementPosition ( target )
- local rotation = getPedRotation( target )
- posX = posX - math.sin ( math.rad ( rotation ) ) * meters
- posY = posY + math.cos ( math.rad ( rotation ) ) * meters
- local bomb = createObject( 1337,posX+1,posY,posZ )
- outputChatBox( "Bomb return: "..tostring( bomb ) )
- setTimer( setElementPosition,50,1,bomb,posX+1,posY,posZ )
- setTimer( setElementPosition,150,1,bomb,posX+3,posY,posZ )
- setTimer( setElementPosition,250,1,bomb,posX+6,posY,posZ )
- setTimer( setElementPosition,350,1,bomb,posX+9,posY,posZ )
- local xo,yo,zo = getElementPosition( bomb )
- setTimer( createExplosion,2000,1,xo,yo,zo, 0 )
- end
- addCommandHandler("bomb", predBomb)
- function getPlayerFromPartialName ( name , player )
- if name then
- local matches = { }
- for index , _player in ipairs ( getElementsByType ( "player" ) ) do
- if getPlayerName ( _player ) == name then
- return _player
- end
- if getPlayerName ( _player ) : gsub ( "#%x%x%x%x%x%x" , "" ) : lower ( ) : find ( name : lower ( ) ) then
- table.insert ( matches , _player )
- end
- end
- if #matches == 1 then
- return matches [ 1 ]
- else
- if player then
- outputChatBox ( "Found " .. #matches .. " matches" , player , 255 , 0 , 0 )
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment