Posts: 429
Threads: 60
Joined: May 2010
Reputation:
0
new random = 0000 + random(9999);
VarInfo = random;
Posts: 191
Threads: 46
Joined: Oct 2010
Reputation:
0
Pero yo no lo quiero asн, aquн un el ejemplo:
Cuando pongas /numero tienes que poner un numero despuйs (/numero 4886) y si no lo escribiste bien te saldrб un error de que no lo escribiste bien.
Posts: 1,461
Threads: 71
Joined: Oct 2010
pawn Код:
dcmd_azar(playerid,params[])
{
if(!IsNumeric(params)) return SendClientMessage(playerid,COLOR_WHITE,"Escrive un numero!");
new string[30],numero;
numero = random(strval(params));
if(strlen(params) > 4) return SendClientMessage(playerid,COLOR_WHITE,"Solo puedes escrivir 4 numeros");
format(string,30,"~r~Azar:~g~%s",numero);
GameTextForPlayer(playerid,string,5000,0);
format(string,30,"Azar con: %s",numero);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
//Is numeric
stock IsNumeric(const string[])
{
new length=strlen(string);
if (length==0) return false;
for (new i = 0; i < length; i++)
{
if (
(string[i] > '9' || string[i] < '0' && string[i]!='-' && string[i]!='+') // Not a number,'+' or '-'
|| (string[i]=='-' && i!=0) // A '-' but not at first.
|| (string[i]=='+' && i!=0) // A '+' but not at first.
) return false;
}
if (length==1 && (string[0]=='-' || string[0]=='+')) return false;
return true;
}
Posts: 1,461
Threads: 71
Joined: Oct 2010
lo que el kiere es que le de un azar
como maximo el numero despues del comando