HunT Posted July 27, 2011 Share Posted July 27, 2011 (edited) Hi all.i want edit the script push in /push "name player" "ammount position z" This is normaly script push /push "name player" 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) Ok i want edit this with this example (raw ) 1 = setElementVelocity ( vehicle, x, y, z+0.10) or only 1 = (vehicle, x, y, z+0.10) 2 = setElementVelocity ( vehicle, x, y, z+0.30) 3 = setElementVelocity ( vehicle, x, y, z+0.50) etc . . . With command /push "name" 2 . . . and call " setElementVelocity ( vehicle, x, y, z+0.30) " Its possible? For me is very hard this Tnx Edited July 27, 2011 by Guest Link to comment
Castillo Posted July 27, 2011 Share Posted July 27, 2011 local pushData = {[1] = "0.10", [2] = "0.20", [3] = "0.30"} function pushim (thePlayer, commandName, id, ...) 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) local data = tonumber(pushData[tonumber(id)]) setElementVelocity ( vehicle, x, y, z+data) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) Link to comment
SDK Posted July 27, 2011 Share Posted July 27, 2011 Assuming you can find the playername without passing all the command arguments to findPlayer: function pushim (thePlayer, commandName, namepart, ammount) player = findPlayer(namepart) if not player then outputChatBox("* /push: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) if tonumber(amount) then amount = tonumber(amount) - 1 else amount = 0 end z = z + 0.10 + 0.20 * amount setElementVelocity ( vehicle, x, y, z ) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) Link to comment
HunT Posted July 27, 2011 Author Share Posted July 27, 2011 The Castillo version is awesome but i change the "id" to "ammount" and "..." with "namepart" . . .why without (namepart) no work now is perfect Very Tnx Castillo & SDK fast help This : local pushData = {[1] = "0.10", [2] = "0.20", [3] = "0.30"} function pushim (thePlayer, commandName, namepart, ammount) player = findPlayer(namepart) if not player then outputChatBox("* /push: player not found", thePlayer) elseif isPedInVehicle(player) then local vehicle = getPedOccupiedVehicle(player) x,y,z = getElementVelocity(vehicle) local data = tonumber(pushData[tonumber(ammount)]) setElementVelocity ( vehicle, x, y, z+data) outputChatBox( getPlayerName(thePlayer).. " Push " ..getPlayerName(player), getRootElement(), 255, 255, 0, true) end end addCommandHandler("push", pushim) function findPlayer(namepart) 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