gerar palavra aleatуria
PHP код:
|
\gamemode SAMP\gamemodes\Roleplay.pwn(3584) : error 047: array sizes do not match, or destination array is too small Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
PlayerData[playerid][pIdentidade] = GenerateRandomWord(); //error
enum yourenum { //*** pIdentidade[MAX_WORDS], //*** }
gamemode SAMP\gamemodes\Roleplay.pwn(62) : error 074: #define pattern must start with an alphabetic character gamemode SAMP\gamemodes\WR-Roleplay.pwn(165) : error 017: undefined symbol "MAX_WORDS" gamemode SAMP\gamemodes\Roleplay.pwn(1109) : error 017: undefined symbol "MAX_WORDS" gamemode SAMP\gamemodes\Roleplay.pwn(1109) : error 009: invalid array size (negative, zero or out of bounds) gamemode SAMP\gamemodes\Roleplay.pwn(1109) : error 036: empty statement gamemode SAMP\gamemodes\Roleplay.pwn(1109) : fatal error 107: too many error messages on one line Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 6 Errors.
stock GenerateRandomWord()
{
new iKey[MAX_WORDS]; //error
for(new i; i != MAX_WORDS; ++i){
iKey[i] = (i % 2 ? random('Z'-'A')+'A' : random('x'-'a')+'a');
}
return iKey;
}
PlayerData[playerid][pIdentidade] = GenerateRandomWord();
format(PlayerData[playerid][pIdentidade], 50, GenerateRandomWord());
stock GenerateRandomWord()
{
new iKey[15];
for(new i; i != 15; ++i)
iKey[i] = (i % 2 ? random('1'-'9')+'A' : random('x'-'a')+'a');
return iKey;
}
It has been resolved, How do I generate only numbers, from 1 to 9?
@edit Why is not it working? PHP код:
|
stock GenerateRandomWord()
{
new iKey[15];
for(new i; i != 15; ++i)
iKey[i] = (i % 2 ? random('9'-'1')+'1' : random('x'-'a')+'a');
return iKey;
}
minrandom(min, max)
return random(max - min) + min;
isOdd(number)
return number & 1; // faster than mod
iKey[i] = isOdd(i) ? minrandom('1', '9') : minrandom('a', 'z');