ice_brasil Posted June 11, 2013 Share Posted June 11, 2013 I want when I type / push (playername) the player chosen to come to me My Client: addCommandHandler("push", function(p, c, t) local pushPlayer = findPlayer(t) if pushPlayer then local pushVehicle = getPedOccupiedVehicle(pushPlayer) if pushVehicle then local speedX, speedY, speedZ = getElementVelocity(pushVehicle) setElementVelocity(pushVehicle, 0, 0, 0+0.2) outputChatBox("getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) end end end ) function findPlayer(name) local name = name:lower() for i, p in ipairs(getElementsByType("player")) do local fullname = getPlayerName(p):lower() if string.find(fullname:gsub("#%x%x%x%x%x%x", ""), name, 1, true) then return p end end return false end What did this wrong? Link to comment
TAPL Posted June 11, 2013 Share Posted June 11, 2013 Replace this: outputChatBox("getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) With this: outputChatBox(getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) Link to comment
ice_brasil Posted June 11, 2013 Author Share Posted June 11, 2013 WARNING:Loading script failed: tpa/trazer.lua:9:')' expected near 'pushes' Link to comment
iPrestege Posted June 11, 2013 Share Posted June 11, 2013 (edited) addCommandHandler("push", function(p, c, t) local pushPlayer = findPlayer(t) if pushPlayer then local pushVehicle = getPedOccupiedVehicle(pushPlayer) if pushVehicle then local speedX, speedY, speedZ = getElementVelocity(pushVehicle) setElementVelocity(pushVehicle, 0, 0,0.2) outputChatBox(" "..getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) end end end ) function findPlayer(name) local name = name:lower() for i, p in ipairs(getElementsByType("player")) do local fullname = getPlayerName(p):lower() if string.find(fullname:gsub("#%x%x%x%x%x%x", ""), name, 1, true) then return p end end return false end Edited June 11, 2013 by Guest Link to comment
ice_brasil Posted June 11, 2013 Author Share Posted June 11, 2013 WARNING:Loading script failed: tpa/trazer.lua:9:')' expected near 'pushes' Link to comment
ice_brasil Posted June 12, 2013 Author Share Posted June 12, 2013 viewtopic.php?f=91&t=60622 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