16.04.2016, 14:26
Idk why but whenever I generate a code it's generating the same code for some reason...
PHP код:
stock randomchar( bool:useDigits = false ) {
if( useDigits ) {
if( random(1000)%2==0 )
return 48 + random(10);
else
return (random(1000)%2==0) ? (65 + random(26)) : (97 + random(26));
} else
return ( random(1000) %2 ==0 ) ? (65 + random(26)) : (97 + random(26));
}
CMD:publishcode(playerid,params[]){
LoggedCMD LAdminCMD
if(CodeExists) return MSG(playerid,C_RED,"[Error] {ff9999}/DeleteCode to delete the current unused code.");
new String[128],String2[24];
if(sscanf(params,"sd",CodeType,CodeAmount)) return MSG(playerid,C_RED,"[Error] {ff9999}/PublishCode [Money/Materials/EnergyPills/Heroin/Ecstasy/Cocaine/Crack/Pot/EXP] [Amount]");
if(CodeAmount<1) return MSG(playerid,C_RED,"[Error] {ff9999}Invalid amount.");
for(new i = 0; i < sizeof(RandomString); i++)
format( RandomString, sizeof( RandomString ), "%s%c", RandomString, randomchar());
MSGTA(C_NICE,"--------------------------------------------------------------------");
format(String,sizeof(String),"[Admin] %s has published a %s code!",GetName(playerid),CodeType);
MSGTA(0x4F87FFFF,String);
format(String2,sizeof(String2),"[CODE] %s",RandomString);
MSGTA(0x4F87FFFF,String2);
MSGTA(C_NOTE,"[TIP] /RedeemCode to redeem the code!");
MSGTA(C_NICE,"--------------------------------------------------------------------");
CodeExists = true;
return 1;}