SA-MP Forums Archive
random world and numbers - 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 world and numbers (/showthread.php?tid=624211)



random world and numbers - Karolukas123 - 12.12.2016

hello, i need little help

i use for text, and how detech what number i got ? like if i got text2 how to make it to number ?

for example

i got text3, and i need get number of that. to make:

whatiteamsigot = that number for; (text3)

Код:
iteams[][] = { "text1", "text2", "text3", "text4", "text5", "text6", "text7" }


format(str, sizeof str, "%s", iteams[random(sizeof iteams)]);
SendClientMessage(playerid, -1, str)



Re: random world and numbers - Dayrion - 12.12.2016

PHP код:
iteams[][] = { "text1""text2""text3""text4""text5""text6""text7" }

new 
random(sizeof(iteams));
format(strsizeof str"%s & %i"iteams[a], a);
SendClientMessage(playerid, -1str



Re: random world and numbers - Karolukas123 - 12.12.2016

no :/ still have problem


Re: random world and numbers - Dayrion - 12.12.2016

So explain it better. I don't understand. /:


Re: random world and numbers - Karolukas123 - 12.12.2016

mhmm.. okey

iteams[][] = { "text1", "text2", "text3", "text4", "text5", "text6", "text7" }


format(str, sizeof str, "%s", iteams[random(sizeof iteams)]);
SendClientMessage(playerid, -1, str)

code works and i get text2. so if i get text2 i need make for player iteam ID2

so its should work like:

text2 = playerIteamID(2)
if text1 = playerIteamID(1)


Re: random world and numbers - Dayrion - 12.12.2016

PlayerItemID is an integer ?


Re: random world and numbers - SickAttack - 12.12.2016

new number = random(sizeof(iteams));

number is the number you "got"