Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/07/23 in all areas

  1. Good way to make what? If you always pass localPlayer as source and the first argument when triggering from client to server, you may as well not have the first argument, ignore the value of source and just use client variable. Doing comparison of values may help you detect some of the faked calls (if the values don't match, it's obviously faked), but unless you do something different in those cases (such as logging/kicking/banning), I don't see any use in that - if you rely on equality of received values to silently ignore the obviously-faked calls, the hackers will pass equal values to avoid the calls getting detected as faked.
    1 point
  2. local spawns = { [1] = {1829.65564,-1842.47327,13.57813,178}; -- x , y ,z , and z rotation [2] = {2083.15747,-1844.75122,12.79247,359}; [3] = {2893.39746,-1638.96423,10.45679,333}; } local distances = {} respawn = function(ammo, attacker, weapon, bodypart) local x,y,z = getElementPosition(source) for k,v in ipairs(spawns) do distances[k] = getDistanceBetweenPoints3D(x,y,z,spawns[k][1],spawns[k][2],spawns[k][3]) end local a = math.min(distances[1],distances[2],distances[3]) for i=1,#distances do if distances[i] == a then spawnPlayer(source,spawns[i][1],spawns[i][2],spawns[i][3],spawns[i][4]) end end distances = nil distances = {} end addEventHandler("onPlayerWasted",getRootElement(),respawn) -- my spawns are random coordinates to test the script, they are not hospital spawns and also u have to change the z rotation to your wanted rotation. also if u have in spawns table more indexes u need to add more distances in local a = math.min() if u have 5 then u add five distances, here i have 3 spawns so 3 distances
    1 point
  3. Well first wee need only 1 resource! a) you need a table with all spawn locations like this local spawns = { [1] = {0,0,0}; [2] = {5,5,5}; --etc this is just an example } -- in this table u will put your spawn coords from the hospitals b) you need this event -> onPlayerWasted c) also this https://wiki.multitheftauto.com/wiki/GetDistanceBetweenPoints3D d) and another function math.min() e) and if u know how to loop through a table u wont need many lines of code to do this.
    1 point
×
×
  • Create New...