Feche1320 Posted December 28, 2010 Share Posted December 28, 2010 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
Aibo Posted December 28, 2010 Share Posted December 28, 2010 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
Feche1320 Posted December 28, 2010 Author Share Posted December 28, 2010 Wow, thanks again, but I have a question. This line: local player, playerName = findPlayer(toblow) if player then Won't be player always 0 since you didn't add a value to it? Thanks Link to comment
Remp Posted December 29, 2010 Share Posted December 29, 2010 findPlayer returns 2 values (when successful), the first goes into 'player' and the second into 'playerName' 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