SparkzZ Posted August 18, 2011 Posted August 18, 2011 i did a Push Script But i dosn't work 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.5, 0+0.2) outputChatBox(getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!") 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's the probleme ?
Castillo Posted August 18, 2011 Posted August 18, 2011 Firstly, this should go in the Scripting section. I only can see that you aren't pushing him up at all, so I've changed some things on it. 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, speedX, speedY, speedZ+0.2) outputChatBox(getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!") 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted August 18, 2011 Posted August 18, 2011 It is working, I've tested it, you must be in a vehicle to be able to get pushed. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
SparkzZ Posted August 18, 2011 Author Posted August 18, 2011 /debugscript 3 ERROR:push/push.lua:16:attempt to index local 'name' (a nil value)
Castillo Posted August 18, 2011 Posted August 18, 2011 You are using it as /push right? if you do /push it won't work. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted August 18, 2011 Posted August 18, 2011 No problem. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
SparkzZ Posted August 19, 2011 Author Posted August 19, 2011 Sorry i am new scripter outputChatBox(getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!") how to set it with colors ?
JR10 Posted August 19, 2011 Posted August 19, 2011 There is arguments for colors. outputChatBox("RED", root, 255, 0, 0) 255 , 0 , 0 Represents the color which will be red in this case. Read the arguments of every function @ the wiki : https://wiki.multitheftauto.com/wiki/Main_Page Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
SparkzZ Posted August 19, 2011 Author Posted August 19, 2011 (edited) There is arguments for colors. outputChatBox("RED", root, 255, 0, 0) 255 , 0 , 0 Represents the color which will be red in this case. Read the arguments of every function @ the wiki : https://wiki.multitheftauto.com/wiki/Main_Page now it's outputChatBox("getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) after i did this script not working can u give me Script with colors coz i tryied but when i put "getPlayerName(p).." with colors didn't work if i removed " it works Edited August 19, 2011 by Guest
JR10 Posted August 19, 2011 Posted August 19, 2011 Post the errors/warnings use /debugscript 3 Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
SparkzZ Posted August 19, 2011 Author Posted August 19, 2011 k /debugscript 3 WARNING:Loading Script Failed:push/push.lua:9: ')' exepted near 'pushes' Script now 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
JR10 Posted August 19, 2011 Posted August 19, 2011 outputChatBox(getPlayerName(p).." pushes "..getPlayerName(pushPlayer).." up!", root, 255, 0, 0) Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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