Jump to content

PUSH


BlackIN

Recommended Posts

  • 2 weeks later...
function push1 ( playerSource, command ) 
player=getLocalPlayer(playerSource) 
    if isPedInVehicle(player) then 
        local vehicle=getPedOccupiedVehicle(player) 
x,y,z=getElementVelocity(vehicle) 
  
setElementVelocity ( vehicle, x, y, z+0.20) 
   
end 
end 
  
addCommandHandler("push", push1) 

  
<meta> 
     
    <script src="push_c.lua" type="client" /> 
</meta> 

Now How to Push Others ? And Get a Text in Chat You have been Pushed By Admin Name

Link to comment

You should make it server side then.

  
function push1 (thePlayer, commandName, who) 
player = getPlayerFromName(who) 
if isPedInVehicle(player) then 
local vehicle = getPedOccupiedVehicle(player) 
x,y,z = getElementVelocity(vehicle) 
setElementVelocity ( vehicle, x, y, z+0.20) 
outputChatBox("* You have been pushed by ".. getPlayerName(thePlayer),player,0,255,0) 
end 
end 
addCommandHandler("push", push1) 

<meta> 
    <script src="push_c.lua" type="server" /> 
</meta> 

Link to comment

Server-side

function push1 ( playerSource, command ) 
x, y, z = getElementVelocity(playerSource) 
setElementVelocity ( playerSource, x, y, z+0.20) 
end 
addCommandHandler("push", push1) 

<meta> 
    <script src="push_c.lua" type="server" /> 
</meta> 
  

Link to comment

What? That's only working on the player who typed the command ...

This has an extra check for you typing the right name:

function push1 (thePlayer, commandName, who) 
  player = getPlayerFromName(who) 
  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.20) 
    outputChatBox("* You have been pushed by ".. getPlayerName(thePlayer),player,0,255,0) 
  end 
end 
addCommandHandler("push", push1) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...