Quick [Random] Question
#5

Quote:
Originally Posted by liquor
Посмотреть сообщение
pawn Код:
new rand = random(sizeof(DROPMATS));
SetPlayerCheckpoint(playerid, DROPMATS[rand][0], DROPMATS[rand][1], DROPMATS[rand][2], 3);


// Add THIS
new string[128],location[32];

// Find out what location was randomly chosen, and format the location string accordingly
if(rand  == 0)) format(location,32,"Location 1");
if(rand  == 1)) format(location,32,"Location 2");
if(rand  == 2)) format(location,32,"Location 3");
if(rand  == 3)) format(location,32,"Location 4");
if(rand  == 4)) format(location,32,"Location 5");
if(rand  == 5)) format(location,32,"Location 6");
if(rand  == 6)) format(location,32,"Location 7");

// Create a string including the name of the location, e.g "Location 1"
format(string,sizeof(string),"The package reads %s. Deliver it to the red marker.",location);
SendClientMessage(playerid,-1, string);
I would've done it differently but this should work with your existing code, if
it actually works, i have not tested or looked for any errors in your code.

I haven't scripted for years so I could've made a mistake.
You added an extra bracket on the "if(rand == 1)) format(location, bla bla bla)".

lol, but thanks very much man, it worked and I REP'ed you. Again, thanks.
Reply


Messages In This Thread
Solved [Ignore this thread] - by Ciarannn - 11.01.2015, 18:05
Re: Quick [Random] Question - by Kruno88 - 11.01.2015, 18:10
Re: Quick [Random] Question - by Ciarannn - 11.01.2015, 18:30
Re: Quick [Random] Question - by liquor - 11.01.2015, 19:12
Re: Quick [Random] Question - by Ciarannn - 11.01.2015, 20:24
Re: Quick [Random] Question - by liquor - 11.01.2015, 21:22

Forum Jump:


Users browsing this thread: 1 Guest(s)