![]() |
#1 |
Gangsta
![]() ![]() ![]() ![]() Join Date: Mar 2015
Posts: 674
Reputation: 50
|
![]() PHP Code:
I want to type /startm and set random militarjob[playerid] = Random (1, 7, 14 or 20) one of these 4. How can I achieve this? Can I set MilitarJob[playerid] = X. X = 1, 7, 14 ,20 ? |
![]() |
![]() |
![]() |
#2 |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2014
Location: India
Posts: 1,548
Reputation: 170
|
![]()
You can make an array with these 4 values and then use ‘random’ function.
|
![]() |
![]() |
![]() |
#3 |
Little Clucker
![]() Join Date: Feb 2018
Posts: 35
Reputation: 0
|
![]()
Try this
Code:
forward Militar(playerid); public Militar(playerid); { new rr = random(3); switch(rr) { case 0: militarjob[playerid] = 1; case 1: militarjob[playerid] = 7; case 2: militarjob[playerid] = 14; case 3: militarjob[playerid] = 20; } return 1; } |
![]() |
![]() |
![]() |
#4 | |
Gangsta
![]() ![]() ![]() ![]() Join Date: Mar 2015
Posts: 674
Reputation: 50
|
![]() Quote:
PHP Code:
PHP Code:
? |
|
![]() |
![]() |
![]() |
#5 | |
High-roller
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2014
Location: India
Posts: 1,548
Reputation: 170
|
![]() Quote:
http://wiki.sa-mp.com/wiki/Random |
|
![]() |
![]() |
![]() |
#6 | |
Gangsta
![]() ![]() ![]() ![]() Join Date: Mar 2015
Posts: 674
Reputation: 50
|
![]() Quote:
Did these, now I should MilitarJob[playerid] = rr; ? |
|
![]() |
![]() |
![]() |
#8 |
Banned
![]() Join Date: Oct 2014
Location: Iran
Posts: 1,273
Reputation: 366
|
![]() PHP Code:
PHP Code:
|
![]() |
![]() |
![]() |
#9 |
Little Clucker
![]() Join Date: Sep 2017
Posts: 41
Reputation: 6
|
![]()
You post easy stuff almost every day, you should take a good look at the samp functions before consulting here
|
![]() |
![]() |
![]() |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Random give me 80 same pos ! | DiamantEspace18 | Scripting Help | 0 | 14/01/2015 11:43 AM |
how give random player weapon? | EitayEliyahu | Scripting Help | 7 | 05/08/2013 05:43 PM |
[HELP]Give random weapon HELP ME = REP+ xD | InTeL_cOrE_i7 | Scripting Help | 3 | 10/06/2013 01:17 PM |
give random money and msg print if its low or high | omidi | Scripting Help | 2 | 18/03/2013 10:57 PM |
Random give | knackworst | Help Archive | 18 | 05/11/2010 06:29 PM |