stock AddUnlock(const String:id[], const String:name[], numLevels, cost[], const String:required[]="", requireLevel=1){
decl String:rid[sizeof(unlocksId[])];
strcopy(rid, sizeof(rid), id);
ReplaceString(rid, sizeof(rid), "=", "");
ReplaceString(rid, sizeof(rid), ";", "");
ReplaceString(rid, sizeof(rid), "'", "");
if(strlen(rid)<3){
return -1;
}
new i;
new index=UnlockIdToIndex(id);
if(index!=-1){
i=index;
}else{
i=SearchAvaliableUnlockIndex();
}
if(numLevels<1) numLevels=1;
if(numLevels>MAX_UNLOCK_LEVEL) numLevels = MAX_UNLOCK_LEVEL;
unlocksValid[i]=true;
new bool:isTheSame = StrEqual(rid, unlocksId[i]);
strcopy(unlocksId[i], sizeof(unlocksId[]), rid);
strcopy(unlocksName[i], sizeof(unlocksName[]), name);
for(new j=0;j<numLevels;++j){
unlocksCost[i][j]=cost[j];
}
unlocksMaxLevel[i]=numLevels;
if(strlen(required)==0){
unlocksRequire[i]=-1;
}else{
new rindex=UnlockIdToIndex(required);
unlocksRequire[i]=rindex;
unlocksRequireLevel[i]=requireLevel;
}
if(!isTheSame){
for(new j=0;j<MAXPLAYERS+1;++j){
unlock[j][i]=0;
}
}
return i;
}