Help with randoming from a file - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with randoming from a file (
/showthread.php?tid=96457)
Help with randoming from a file -
Gappy - 08.09.2009
I've got this:
pawn Код:
LoadRandomSpawnFromFile(const team[])
{
new File:file, str[128];
format(str, sizeof str, "CoDS/Maps/%s/%sspawns.ini", MapName, team);
file = fopen(str, io_read);
if (!file) return 0;
new
line[128],
count = 0,
Float:X, Float:Y, Float:Z, Float:A;
while (fread(file, line))
{
if (!sscanf(line, "ffff", X, Y, Z, A))
{
format(str, sizeof str, "%f %f %f %f",X, Y, Z, A);
count++;
}
}
fclose(file);
return count;
}
Which formats all the team spawn points in the file, how do I then random all those spawns and SetPlayerPos in one of the random spawns?
I know to do SetPlayerPos but how do I random the spawns after formatting them all?
Thanks.
Re: Help with randoming from a file -
Gappy - 08.09.2009
I'm completely stuck with this, anyone know how to do it?
Re: Help with randoming from a file -
Gappy - 09.09.2009
This is getting so frustrating.