SA-MP Forums Archive
Random string - 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)
+--- Thread: Random string (/showthread.php?tid=379191)



Random string - RedFusion - 20.09.2012

How do i randomise a string from these options for example: {hey,hello,sup,waddup,hi}
and then format the randomised string into another string?


Re: Random string - ViniBorn - 20.09.2012

Ex:
pawn Код:
new RandomString[5][8] = {
{"hey"},
{"hello"},
{"sup"},
{"waddup"},
{"hi"}
};

//format
new VBString[24];
format(VBString, sizeof VBString, "Test : %s", RandomString[random(sizeof(RandomString))]);