Jump to content

Blow a player without putting their colors.


Feche1320

Recommended Posts

function blowPlayer(source, command, toblow) 
    if not g_Admin[source] then 
        outputChatBox("You don't have the permission for this.", source, 255, 0, 0) 
        return 
    else 
        if toblow then 
            if getPlayerFromName(toblow) then 
                blowVehicle(getPedOccupiedVehicle(getPlayerFromName(toblow))) 
                outputChatBox("#01DFD7" ..getPlayerName(toblow).. "has been blown up.", 0, 0, 0, true) 
            end 
        end 
    end 
end 
addCommandHandler('bu', blowPlayer) 

But if my name is' #FFFFFFASD.', I have to type #FFFFFFASD. to blow him, and I need it to blow him by only putting ASD

Thanks

Link to comment
  
function findPlayer(namepart) 
  for i, player in ipairs(getElementsByType("player")) do 
    local name = getPlayerName(player) 
    if string.find(name:lower(), namepart:lower(), 1, true) then return player, name end 
  end 
  return false 
end 
  
function blowPlayer(source, command, toblow) 
    if not g_Admin[source] then 
        outputChatBox("You don't have the permission for this.", source, 255, 0, 0) 
        return 
    else 
        if toblow then 
            local player, playerName = findPlayer(toblow) 
            if player then 
                blowVehicle(getPedOccupiedVehicle(player)) 
                outputChatBox("#01DFD7" ..playerName.. " has been blown up.", 0, 0, 0, true) 
            end 
        end 
    end 
end 
addCommandHandler('bu', blowPlayer) 
  

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...