15.12.2010, 11:46
(
Last edited by JaTochNietDan; 18/07/2011 at 12:49 AM.
)
Random Spawn Array Generator
What is it?It's a simple tool to generate an array in Pawn from a SavedPositions.txt file. It will automatically format and generate the array to store all of the positions. This is the kind of script I wrote for myself when doing a large bulk of these things, since doing it manually is painful.
__________________________________________________
I don't understand, can you give me an example?
Okay sure, lets say for example you are getting a HUGE amount of random spawn locations for your server, then you want to store them all in an array so you can set the player to each of the positions randomly. So you open your SavedPositions.txt with all of the saved positions in it, which looks like this:
Code:
AddPlayerClass(1,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(2,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(269,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(270,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(271,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(272,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(47,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(48,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(49,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(50,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(51,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(52,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(53,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(54,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(55,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(56,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(57,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(58,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(68,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(69,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(70,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(71,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(72,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(73,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(75,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(76,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(78,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(79,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(80,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(81,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(82,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(83,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(84,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(85,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(87,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(88,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(89,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(91,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(92,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(93,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(95,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(96,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(97,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(98,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1); AddPlayerClass(99,1759.0189,-1898.1260,13.5622,266.4503,-1,-1,-1,-1,-1,-1);
With this tool, you simply copy and paste that in, and it turns into:
pawn Code:
new randomSpawns[45][4] = {
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503},
{1759.0189,-1898.1260,13.5622,266.4503}
};
https://sampforum.blast.hk/showthread.php?tid=162488
__________________________________________________
Are there any other uses besides random spawns?
Well maybe you want to add a trucking mission with random destinations, that may also require such positions saved into an array, be creative!
__________________________________________________
Tool Location
http://www.jatochnietdan.com/tools/?tool=randomspawn
Tool Source
http://pastebin.com/13nAj00J
* Excludes designs and formatting
__________________________________________________
Enjoy! Feedback and suggestions are appreciated as always