matito6 Posted February 9, 2012 Share Posted February 9, 2012 Hi. I would like you to ask you here or on GG(ICQ): 39955854 ,sent me the script ready, "Push" I do not know how to do it. I would also like to work on a type /push Euro or the console (bind) Link to comment
GTX Posted February 9, 2012 Share Posted February 9, 2012 Look around the MTA forums! I have seen many people asking the same question. Link to comment
HunT Posted February 9, 2012 Share Posted February 9, 2012 Include NamePart Example : /push mat or /push o6 for bind u can use /bind "key" (example p) "name" (example youself) = /bind p mati Enjoy (server-side) function pushim (thePlayer, commandName, ...) player = findPlayer(...) if not player then outputChatBox("* /push: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) 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 Link to comment
GTX Posted February 9, 2012 Share Posted February 9, 2012 That will not work with hex codes, e.g: Player's name will be GT#ff0000X and you will write /push GTX. This will not work. You can use that: function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end Link to comment
matito6 Posted February 9, 2012 Author Share Posted February 9, 2012 Where it all, upload, as you wrote? : ( Link to comment
Castillo Posted February 9, 2012 Share Posted February 9, 2012 function pushim (thePlayer, commandName, ...) local player = findPlayer(...) if (not player) then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end Link to comment
matito6 Posted February 9, 2012 Author Share Posted February 9, 2012 Sorry, but you could tell me where to upload? I know that to. lua and then meta.xml but I do not know how to do meta.xml. Could someone send me the script ready? Or tell me how to do it ok? Link to comment
Castillo Posted February 9, 2012 Share Posted February 9, 2012 Learn how to make a meta.xml here: https://wiki.multitheftauto.com/wiki/Meta.xml P.S: Everyone: Please let him do it by himself. Link to comment
matito6 Posted February 9, 2012 Author Share Posted February 9, 2012 meta.xml well done? : "Euro" type="script" name="push" /> "meta.xml" type="client"/> Link to comment
Xeno Posted February 9, 2012 Share Posted February 9, 2012 You dont need this: <config src="meta.xml" type="client"/> And the push script is client, not server. Good job otherwise ;D Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 meta.xml well done but will not turn on the script. What wrong have I done? I give what I have written in .lua : function pushim (thePlayer, commandName, ...) player = findPlayer(...) if not player then outputChatBox("* /push: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) 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 Edit: as part of the console, push start, writes: Resource could not be found, what I did wrong! Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 as part of the console, push start, writes: Resource could not be found, what I did wrong! Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 You dont need this: <config src="meta.xml" type="client"/> And the push script is client, not server. Good job otherwise ;D Wrong, it's SERVER SIDE. @matito6: Did you refresh by /refresh? or just writing refresh in server console (black window)? Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 still the same (Resource could not be found) will help? I do not know how to do it, and I care about this why is not working: (? @Solidsnake14 Could you do me this script? Please, I'm green at this: ( Edit: guys! script to push off, but it does not work when you type /push Euro, you know why? Link to comment
Castillo Posted February 10, 2012 Share Posted February 10, 2012 Use this one: function pushim (thePlayer, commandName, ...) local player = findPlayer(...) if (not player) then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 What could I do wrong? meta.xml is well, lua is also well done. So what is wrong?! please Help Link to comment
GTX Posted February 10, 2012 Share Posted February 10, 2012 Did you refresh and start the script? Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 Still does not work. I did restart, refresh, and nothing. I do not know what's going on?! Can you help? Link to comment
Evil-Cod3r Posted February 10, 2012 Share Posted February 10, 2012 can you so the full code ? Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 Post meta.xml and see in the console when you refresh if you get any error. Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 Let me give you the contents of .xml file and .lua xml : "Euro" type="script" name="push" /> "meta.xml" type="server"/> Lua : function pushim (thePlayer, commandName, ...) local player = findPlayer(...) if (not player) then outputChatBox("* /push: player not found", thePlayer) return end if isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) setElementVelocity ( vehicle, x, y, z+0.30) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) local player = getPlayerFromName(namepart) if player then return player end for _,player in ipairs(getElementsByType("player")) do if string.find(string.gsub(getPlayerName(player):lower(),"#%x%x%x%x%x%x", ""), namepart:lower(), 1, true) then return player end end return false end Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 Or give you a link to these files and if you could change what you need in lua and xml. Link: http://w515.wrzuta.pl/plik/9UiKiVI6srR/push Link to comment
drk Posted February 10, 2012 Share Posted February 10, 2012 http://www.4shared.com/zip/aH9FUa06/push.html Link to comment
matito6 Posted February 10, 2012 Author Share Posted February 10, 2012 when you type /push Euro, nothing happens. Why ? script is running 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