Search the Community
Showing results for tags 'randomize'.
-
Hello everyone I currently have this function that develops, and some time and I wanted to make a change most do not know it as good is simple. local positions = { { 371, -2040, 8 }, { 2274, -1036, 52 }, { -2245, -1723, 482 }, { -155, -2889, 428 }, } function DisappearPlayer (NamePlayer, Admin) local azar = math.random ( #positions ) local veh = getPedOccupiedVehicle(NamePlayer) if (veh) then setElementPosition(veh, unpack ( positions [ azar ] ) ) else setElementPosition(NamePlayer, unpack ( positions [ azar ] ) ) end end addEvent("random",true) addEventHandler("random",getRootElement(),DisappearPlayer) This teleports the player into a random position map using a table of coordinates. Ok everything works perfectly. But I wanted it stores up the item from the table that has already been used and not used again until the last was used or the successor. Ex local positions = { { 1 }, { 2 }, { 3 }, { 4 }, } function DisappearPlayer (NamePlayer, Admin) local azar = math.random ( #positions ) local veh = getPedOccupiedVehicle(NamePlayer) if (veh) then setElementPosition(veh, unpack ( positions [ azar ] ) ) else setElementPosition(NamePlayer, unpack ( positions [ azar ] ) ) end end addEvent("random",true) addEventHandler("random",getRootElement(),DisappearPlayer) so that happens. 3,3,2,1,3,4,4 way I wanted it occurs. 3.1.2.4 or 3.2.3.1.3 in a way that the same n repeita then! Anyone know how to do?