Jump to content

I am looking for a finished script "Push"


matito6

Recommended Posts

Posted

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)

Posted

Look around the MTA forums! I have seen many people asking the same question.

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted

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 
  

Posted

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 
  
  

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted
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 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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?

Posted

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!

Posted
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)?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

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?

Posted

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 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

can you so the full code ?

My in-game nick is |['Dev-PoinT_SA']|

addEventHandler ( "onPlayerSpawn", getRootElement(),

function()

if (getPlayerName(source) == "Dev-PoinT") and (getPlayerTeam == "Admin") then

triggerClientEvent("BlaBlaBla",getRootElement())

DxDrawText("Hi Dev-PoinT")

end

end)

Posted

Post meta.xml and see in the console when you refresh if you get any error.

EPT Team Server Development: 0%

Learning C++ | C++ is amazing xD

Posted

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 

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...