pawn Код:
stock PodeJetpack(playerid)
{
new string[MAX_PLAYER_NAME+16], pName[MAX_PLAYER_NAME],
li[2][64], li_Name[MAX_PLAYER_NAME], li_Level;
GetPlayerName(playerid, pName, sizeof(pName));
if(fexist("UsuariosQuePodemUsarJetPack.txt"))
{
new File:help = fopen("UsuariosQuePodemUsarJetPack.txt", io_read);
new i = 0;
while(fread(help, string))
{
split(string, li, '=');
strmid(li_Name, li[0], 0, strlen(li[0]), 255);
li_Level = strval(li[1]);
if(!strcmp(li_Name, pName, true) && li_Level != 0)
{
return true;
}
i++;
}
fclose(help);
}
return false;
}
public PodeUsarJetpack(playerid, bool:pode)
{
new string[MAX_PLAYER_NAME+16], pName[MAX_PLAYER_NAME],
li[2][64], li_Name[MAX_PLAYER_NAME], li_Level;
GetPlayerName(playerid, pName, sizeof(pName));
if(fexist("Users/Helpers/Names.txt"))
{
new File:help = fopen("UsuariosQuePodemUsarJetPack.txt", io_read);
new i = 0;
while(fread(help, string))
{
split(string, li, '=');
strmid(li_Name, li[0], 0, strlen(li[0]), 255);
li_Level = strval(li[1]);
if(!strcmp(li_Name, pName, true) && li_Level != 0)
{
format(string, sizeof(string), "%s=%d\r\n", pName, pode);
fwrite(help, string);
fclose(help);
return 1;
}
i++;
}
fclose(help);
fopen("UsuariosQuePodemUsarJetPack.txt", io_append);
format(string, sizeof(string), "%s=%d\r\n", pName, pode);
fwrite(help, string);
fclose(help);
}
return 1;
}
Ai, vc usa esse cуdigo pra checar se o kra pode usar o JatPack.
=D
Exemplo:
Код:
if(!PodeJetpack(playerid)) Ban(playerid);
if(!PodeJetpack(playerid)) PodeUsarJetpack(playerid, false);
else PodeUsarJetpack(playerid, true);
Coloca este cуdigo no fim do GM:
pawn Код:
stock split(const strsrc[], strdest[][], delimiter)
{
new i, li;
new aNum;
new len;
while(i <= strlen(strsrc)){
if(strsrc[i]==delimiter || i==strlen(strsrc)){
len = strmid(strdest[aNum], strsrc, li, i, 128);
strdest[aNum][len] = 0;
li = i+1;
aNum++;
}
i++;
}
return 1;
}
#Info:
Qualquer erro, avise. Editei este cуdigo de um outro q eu tinha ali .-.