24.05.2012, 18:50
Simples, Espero que ajude!
pawn Код:
new PTInfoOrg[5][8] = { //5 = Numero de cargos! 8 = Tamanho da maior string + '\0'!
"Lider",
"Membro1",
"Membro2",
"Membro3",
"Membro4"
};
//Preencher arquivo.
new PTOrgFile[15];
format(PTOrgFile, sizeof(PTOrgFile), "/Orgs/%d.ini", PlayerInfo[playerid][pMember]);
if(!fexist(PTOrgFile)) DOF2_CreateFile(PTOrgFile);
DOF2_SetString(PTOrgFile, PTInfoOrg[0], "Sem Lider");
for(new i = 1, PT = sizeof(PTInfoOrg); i != PT; i++) DOF2_SetString(PTOrgFile, PTInfoOrg[i], "Sem Membro");
DOF2_SaveFile();
//Dar Lider
new PTOrgFile[15];
format(PTOrgFile, sizeof(PTOrgFile), "/Orgs/%d.ini", PlayerInfo[playerid][pMember]);
if(fexist(PTOrgFile)) {
if(!strcmp(DOF2_GetString(PTOrgFile, PTInfoOrg[0]), "Sem Lider", true)) {
DOF2_SetString(PTOrgFile, PTInfoOrg[0], GetPlayerNameEx(playerid));
DOF2_SaveFile();
}
}
//Colocar Membro
new PTOrgFile[15];
format(PTOrgFile, sizeof(PTOrgFile), "/Orgs/%d.ini", PlayerInfo[playerid][pMember]);
if(fexist(PTOrgFile)) {
for(new i = 1, PT = sizeof(PTInfoOrg); i != PT; i++) {
if(!strcmp(DOF2_GetString(PTOrgFile, PTInfoOrg[i]), "Sem Membro", true)) {
DOF2_SetString(PTOrgFile, PTInfoOrg[i], GetPlayerNameEx(playerid));
DOF2_SaveFile();
break;
}
}
}
//Pegar Nome
stock GetPlayerNameEx(playerid) {
new PTNome[24]; GetPlayerName(playerid, PTNome, 24);
return PTNome;
}