Jump to content

How to Blow Up player?


LooooP

Recommended Posts

Posted

well, I'm making a Race map, and I have a Client.lua file in my map folder with this:

function ClientStarted ()
setWaterLevel(-150)
end 
 
addEventHandler( "onClientResourceStart", getResourceRootElement(getThisResource()), ClientStarted )

And I want to know: How can I make a code for to the server blow up the vehicle if that is less than -23 in the position Z

Posted

Oh, ty :D

EDIT: This is what I got to do:

function Source
setTimer(Check, 5000)
 
function Check ()
float x, y
UnderWater = getElementPosition(vehicle model="411" posX="x" posY="y" posZ="-23")
setTimer(BlowUp, 1)
 
function BlowUp ()
blowVehicle(UnderWater)
setTimer(Source, 1)

Is it correct?

Posted

Just stopping by here:

getElementPosition(vehicle model="411" posX="x" posY="y" posZ="-23") is wrong.

getElementPosition ( vehicle ) -- vehicle can be retrieved using any getVehicleFrom... or getElement... commands. Is proper.

Posted

what a mess..

copying-pasting few snippets, few random words and joining them together WON'T work. NEVER.

if you want to make anything - sit down, read, spend on it few hours.

Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online!

programista php rzeszów

Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting.

Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!

Posted

Here the code for you

NOTE: It's not debugged because I'm too lazy

EDIT: If you really want to learn lua download some resources from mtasa.com, try to understand them and read the lua tutorial!

EDIT2: There was a mistake @ line 8 getElementPosition but it's fixed now

function startBlowTimer()
setTimer(checkForPosition, 5000, 0) --set the timer to the interval you want! Now it's 5 sec
end
 
function checkForPosition()
players = getElementsByType("player")
for i, player in ipairs(players) do
	x, y, killz = getElementPosition(player)
if (killz < -23) then
		veh = getPedOccupiedVehicle(player)
blowVehicle(veh)
outputChatBox("Your vehicle was blown!", player, 255, 0, 0)
end
end
end
addEventHandler("onResourceStart", getRootElement(), startBlowTimer)

New and active mtasa.com username:

-ffs-Sniper!

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