[Ajuda] JetPack.
#2

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 .-.
Reply


Messages In This Thread
[Ajuda] JetPack. - by Baigou - 05.11.2011, 01:56
Re: [HELP] JetPack. - by Dr_Pawno - 05.11.2011, 02:08
Re: [HELP] JetPack. - by Baigou - 05.11.2011, 02:14
Re: [HELP] JetPack. - by Baigou - 05.11.2011, 02:19
Re: [HELP] JetPack. - by Dr_Pawno - 05.11.2011, 02:21
Re: [HELP] JetPack. - by Baigou - 05.11.2011, 02:24
Re: [HELP] JetPack. - by Dr_Pawno - 05.11.2011, 02:26
Re: [HELP] JetPack. - by Baigou - 05.11.2011, 02:27
Re: [HELP] JetPack. - by Dr_Pawno - 05.11.2011, 02:29
Re: [HELP] JetPack. - by Baigou - 05.11.2011, 02:38

Forum Jump:


Users browsing this thread: 1 Guest(s)