Jump to content

Zlimit death


DuCt_TaPe

Recommended Posts

Posted

Trying to figure out how to implement a Zlimit death to some races. meaning map was posz=60 and u fell off the map you would die at posz= 50

anyone have a solution?

DuCt.jpg
Posted

add this as client side script (more about resources, meta.xml etc on mta wiki)

  
setTimer(function() 
  local xx,yy,zz = getElementPosition(getLocalPlayer()) 
  if (not isPlayerWasted(getLocalPlayer()) and zz < 50) then 
    triggerServerEvent("onPlayerRequestSuicide", getLocalPlayer()) 
  end 
end, 250, 0) 
  

and this as server side:

  
addEvent("onPlayerRequestSuicide", true) 
addEvent("onPlayerRequestSuicide", getRootElement(), function() 
  killPed(source) 
end) 
  

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

hmm, never used settings, i think its time to get some knowledge, i'll edit this post within 15 minutes

edit:

got it, was harder that i think it will, but got it:

client:

  
zlimit = -10000 
  
setTimer(function() 
  local xx,yy,zz = getElementPosition(getLocalPlayer()) 
  if (not isPlayerWasted(getLocalPlayer()) and zz < zlimit) then 
    triggerServerEvent("onPlayerRequestSuicide", getLocalPlayer()) 
  end 
end, 250, 0) 
  
addEvent("onClientCall_race",true) 
addEventHandler("onClientCall_race", getRootElement(), 
function(name, veh, check, obj, pick, opt) 
    if name == 'initRace' then 
        if (opt['Zlimit']) then 
            zlimit = tonumber(opt['Zlimit']) 
        else 
            zlimit = -10000 
        end 
    end 
end) 
  

server

  
addEvent("onPlayerRequestSuicide", true) 
addEvent("onPlayerRequestSuicide", getRootElement(), function() 
  killPed(source) 
end) 
  

i will make it new resource, and upload to community tommorow, i think some ppl will want to have this :)

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)!

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