[DMC] Posted October 9, 2010 Posted October 9, 2010 Ty to varez i could make this function findPlayerByName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function boomPlayer(playerSource, command, arg1, theVehicle) local playerElement = findPlayerByName(arg1) if playerElement then local name = getPlayerName(playerElement) local theVehicle = getPedOccupiedVehicle (playerSource) local sourceName = getPlayerName(playerSource) blowVehicle ( theVehicle ) outputChatBox (""..getPlayerName(playerElement).."Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 0, 0, 5, true) end end addCommandHandler("boom", boomPlayer) but its not working at all, and no errors
dzek (varez) Posted October 9, 2010 Posted October 9, 2010 hmm, you have theVehicle argument in your boomPlayer and trying to overwrite it on line 18 - i dont know what happens in that situation. also for outputChatBox just use: outputChatBox (getPlayerName(playerElement).."Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 0, 0, 5, true) no need for that "".. Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
[DMC] Posted October 9, 2010 Author Posted October 9, 2010 i dont really see what im overwriting but its still not working, i read what you say and no errors nothing ;S and its not outputting it to the chatbox function findPlayerByName(playerPart) local pl = getPlayerFromName(playerPart) if isElement(pl) then return pl else for i,v in ipairs (getElementsByType ("player")) do if (string.find(getPlayerName(v),playerPart)) then return v end end end end function boomPlayer(playerSource, command, arg1, theVehicle) local playerElement = findPlayerByName(arg1) if playerElement then local name = getPlayerName(playerElement) local theVehicle = getPedOccupiedVehicle (playerSource) local sourceName = getPlayerName(playerElement) blowVehicle ( theVehicle ) outputChatBox (getPlayerName(playerElement).." Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 0, true) end end addCommandHandler("boom", boomPlayer)
dzek (varez) Posted October 9, 2010 Posted October 9, 2010 function boomPlayer(playerSource, command, arg1, [b]theVehicle[/b]) local playerElement = findPlayerByName(arg1) if playerElement then local name = getPlayerName(playerElement) local [b]theVehicle[/b] = getPedOccupiedVehicle (playerSource) local sourceName = getPlayerName(playerElement) blowVehicle ( theVehicle ) outputChatBox (getPlayerName(playerElement).." Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 0, true) end end just remove that argument on line 14 in your script Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
[DMC] Posted October 10, 2010 Author Posted October 10, 2010 ok ty varez, now when i do /boom player its destroying me instead of the targer
50p Posted October 10, 2010 Posted October 10, 2010 function boomPlayer(playerSource, command, arg1, [b]theVehicle[/b]) local playerElement = findPlayerByName(arg1) if playerElement then local name = getPlayerName(playerElement) local [b]theVehicle[/b] = getPedOccupiedVehicle (player[b]Element[/b]) local sourceName = getPlayerName(playerElement) blowVehicle ( theVehicle ) outputChatBox (getPlayerName(playerElement).." Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 0, true) end end just remove that argument on line 14 in your script - MTA Script Editor - Ask your scripting questions properly, please. - 50p's public resources - Meta.xml - what is it for? How is it possible LOL
[DMC] Posted October 10, 2010 Author Posted October 10, 2010 function boomPlayer(playerSource, command, arg1, [b]theVehicle[/b]) local playerElement = findPlayerByName(arg1) if playerElement then local name = getPlayerName(playerElement) local [b]theVehicle[/b] = getPedOccupiedVehicle (player[b]Element[/b]) local sourceName = getPlayerName(playerElement) blowVehicle ( theVehicle ) outputChatBox (getPlayerName(playerElement).." Has been destroyed by "..getPlayerName(playerSource).."!", getRootElement(), 255, 255, 0, true) end end just remove that argument on line 14 in your script OK
dzek (varez) Posted October 10, 2010 Posted October 10, 2010 oh, i didnt noticed this.. Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
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