[AJUDA] ME AJUDA AE !
#10

aki a enum de admin

pawn Код:
enum Admin
{
gMembro[MAX_PLAYER_NAME],AdminVaga,
};
enum Helper
{
hMembro[MAX_PLAYER_NAME],HelperVaga,
};
new AdmInfo[31][Admin];new HelperInfo[21][Helper];

public HelperCheck(playerid){new idx = 0;while(idx < sizeof(HelperInfo)){if(strcmp(HelperInfo[idx][hMembro],PlayerName(playerid), true ) == 0 ){return true;}idx++;}return 0;}

public HelpersVaga()
{
new storedcopname[64];
new File: file = fopen("BrasilGames/Helpers.cfg", io_read);
if (file)
{
new valtmp[MAX_PLAYER_NAME];
while (fread(file, valtmp) > 0)
{
strmid(storedcopname, valtmp, 0, strlen("Vazio"), 255);
if ((strcmp(storedcopname, "Vazio", true, strlen("Vazio")) == 0) && (strlen("Vazio") == strlen(storedcopname)))
{
fclose(file);VagaSobrando = 1;
return true;
}
}
}
fclose(file);VagaSobrando = 0;return 0;
}

public AdmCheck(playerid){new idx = 0;while(idx < sizeof(AdmInfo))
{
if(strcmp(AdmInfo[idx][gMembro],PlayerName(playerid), true ) == 0 )
{
return true;
}idx++;
}
return 0;
}

public AdmsVaga()
{
new storedcopname[64];
new File: file = fopen("BrasilGames/Admins.cfg", io_read);
if (file)
{
new valtmp[MAX_PLAYER_NAME];
while (fread(file, valtmp) > 0){strmid(storedcopname, valtmp, 0, strlen("Vazio"), 255);
if ((strcmp(storedcopname, "Vazio", true, strlen("Vazio")) == 0) && (strlen("Vazio") == strlen(storedcopname)))
{
fclose(file);VagaSobrando = 1;return true;}}}fclose(file);VagaSobrando = 0;
return 0;
}

public SaveAdm()
{
new idx;new File: file2;
while (idx < sizeof(AdmInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%s,%d\n",AdmInfo[idx][gMembro],AdmInfo[idx][AdminVaga]);
if(idx == 0)
{
file2 = fopen("BrasilGames/Admins.cfg", io_write);
}
else
{
file2 = fopen("BrasilGames/Admins.cfg", io_append);
}
fwrite(file2, coordsstring);idx++;fclose(file2);
}
return true;
}

public LoadAdm()
{
new arrCoords[2][64];
new strFromFile2[256];
new File: file = fopen("BrasilGames/Admins.cfg", io_read);
if (file){new idx = 0;
while(idx < sizeof(AdmInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
strmid(AdmInfo[idx][gMembro], arrCoords[0], 0, strlen(arrCoords[0]), 255);
AdmInfo[idx][AdminVaga] = strval(arrCoords[1]);idx++;
}
}
fclose(file);
return true;
}

public SaveHelper()
{
new idx;new File: file2;
while (idx < sizeof(HelperInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%s,%d\n",HelperInfo[idx][hMembro],HelperInfo[idx][HelperVaga]);
if(idx == 0)
{
file2 = fopen("BrasilGames/Helpers.cfg", io_write);
}
else{file2 = fopen("BrasilGames/Helpers.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;fclose(file2);
}
return true;
}

public LoadHelper()
{
new arrCoords[2][64];
new strFromFile2[256];
new File: file = fopen("BrasilGames/Helpers.cfg", io_read);
if (file)
{
new idx = 0;
while(idx < sizeof(HelperInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
strmid(HelperInfo[idx][hMembro], arrCoords[0], 0, strlen(arrCoords[0]), 255);
HelperInfo[idx][HelperVaga] = strval(arrCoords[1]);idx++;
}
}
fclose(file);
return true;
}
Reply


Messages In This Thread
[AJUDA] ME AJUDA AE ! - by leosivi - 14.02.2012, 22:25
Re: [AJUDA] ME AJUDA AE ! - by StrondA_ - 14.02.2012, 22:37
Re: [AJUDA] ME AJUDA AE ! - by [NC]BlackSky - 14.02.2012, 22:44
Re: [AJUDA] ME AJUDA AE ! - by leosivi - 14.02.2012, 22:48
Re: [AJUDA] ME AJUDA AE ! - by |_MeGaTroN_| - 14.02.2012, 22:56
Re: [AJUDA] ME AJUDA AE ! - by leosivi - 14.02.2012, 23:08
Re: [AJUDA] ME AJUDA AE ! - by |_MeGaTroN_| - 14.02.2012, 23:13
Re: [AJUDA] ME AJUDA AE ! - by leosivi - 14.02.2012, 23:27
Re: [AJUDA] ME AJUDA AE ! - by 4LiSs0N - 14.02.2012, 23:30
Re: [AJUDA] ME AJUDA AE ! - by leosivi - 14.02.2012, 23:32

Forum Jump:


Users browsing this thread: 1 Guest(s)