CMD:startm(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,2.0, -216.7863, 985.1052, 19.3948))
{
if(Militar[playerid] == 1)
{
MilitarJob[playerid] = 1;
}
else return SendClientMessage(playerid, -1, "{FFCC33}Text!");
}
else return SendClientMessage(playerid,-1,"*"COL_RED" Text !");
return 1;
}
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; }
You can make an array with these 4 values and then use ‘random’ function.
|
new Float:Numbers[][5] =
{
{1},
{2},
{3}.
{4}
};
CMD:startm(playerid, params[])
{
if(IsPlayerInRangeOfPoint(playerid,2.0, -216.7863, 985.1052, 19.3948))
{
if(Militar[playerid] == 1)
{
MilitarJob[playerid] = Numbers;
}
else return SendClientMessage(playerid, -1, "{FFCC33}Text!");
}
else return SendClientMessage(playerid,-1,"*"COL_RED" Text !");
return 1;
}
PHP код:
PHP код:
|
Try this
Код:
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; } |
SetTimerEx("Militar", 1000, false, "i", playerid);
new Float:Numbers[4] =
{
1,
7,
14,
20
};
MilitarJob[playerid] = Numbers[random(sizeof Numbers)];