[Off] Estou tentando aprender :\
#36

pawn Code:
#include "A_SAMP"
#include "DOF2"
// Includes
enum pInfo
{
    bool:Adm, // Variavel Boleana Administrador.
};
new PlayerInfo[MAX_PLAYERS][pInfo];
//Isso aqui vocк jб sabe
//Agora para fazer o banco de dados, coloque em onplayerconect:
public OnPlayerConnect(playerid)
{
    new file[70]; // Variavel para o arquivo.
    new snd[MAX_PLAYER_NAME]; // Variavel nome do player.
    GetPlayerName(playerid,snd,sizeof snd); // Getar nome do player.
    format(file,sizeof file,"%s.ini",snd); // Setando a pasta do arquivo que no caso serб scriptfiles.
    if(!DOF2_FileExists(file)) // Caso o arquivo seja inexistente.
    {
        DOF2_SetBool(file,#Adm,false); // Seta o administrador do player para 0.
        //DOF2_SetBool = Funзгo para setar uma array boleana para o arquivo (para em vez de 0 ou 1 ficar true ou false)
        //Mas tambem tem outras funзхes nela.
        //file = Pasta do arquivo.
        //Adm = Nome da linha que irб ficar dentro do arquivo.
        //Ex: Adm = 0
        //0 = Valor.
        //o # (em alguns casos) pode substituir os "" :) Basta colocar so um no comeзo.
        DOF2_SaveFile(); // Salvar o arquivo.
    } else { // Caso o arquivo exista.
        PlayerInfo[playerid][Adm] = DOF2_GetBool(file,#Adm);
        //Seta para o valor da variavel administrativa ficar igual ao setado no arquivo.
    }
    return 1;
}
//Agora para salvar vocк vai usar a OnPlayerDisconnect:
public OnPlayerDisconnect(playerid,reason)
{
    DOF2_SetBool(file,#Adm,PlayerInfo[playerid][Adm]);
    //Vai setar para a linha Adm do arquivo ficar igual ao valor que tem na variavel 'Adm'.
    DOF2_SaveFile(); // Salvar o arquivo.
    return 1;
}
/*
Outras funзхes da DOF2:
    DOF2_FileExists
    DOF2_RemoveFile
    DOF2_CreateFile
    DOF2_SetString
    DOF2_GetString
    DOF2_SetInt
    DOF2_GetInt
    DOF2_SetBool
    DOF2_GetBool
    DOF2_SetFloat
    DOF2_GetFloat
    DOF2_Unset
    DOF2_IsSet
*/
Nгo й nada complexo, desculpe-me se estiver com algum erro mas minha intenзгo й ajudar
Reply


Messages In This Thread
Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 14:55
Re: Estou tentando aprender :\ - by Q.I - 23.11.2012, 14:58
Re: Estou tentando aprender :\ - by BielCOP - 23.11.2012, 14:59
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:02
Re: Estou tentando aprender :\ - by Q.I - 23.11.2012, 15:03
Re: Estou tentando aprender :\ - by BielCOP - 23.11.2012, 15:05
Re: Estou tentando aprender :\ - by Q.I - 23.11.2012, 15:08
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:12
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 15:18
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:20
Re: Estou tentando aprender :\ - by Abravanel - 23.11.2012, 15:21
Re: Estou tentando aprender :\ - by Sky™ - 23.11.2012, 15:21
Re: Estou tentando aprender :\ - by paulor - 23.11.2012, 15:24
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:24
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 15:25
Re: Estou tentando aprender :\ - by [FeK]Knife - 23.11.2012, 15:28
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:29
Re: Estou tentando aprender :\ - by [FeK]Knife - 23.11.2012, 15:33
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 15:35
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:37
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 15:38
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 15:41
Re: Estou tentando aprender :\ - by [FeK]Knife - 23.11.2012, 15:43
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 15:50
Re: Estou tentando aprender :\ - by paulor - 23.11.2012, 15:57
Re: Estou tentando aprender :\ - by BielCOP - 23.11.2012, 16:00
Re: Estou tentando aprender :\ - by [FeK]Knife - 23.11.2012, 16:03
Re: Estou tentando aprender :\ - by paulor - 23.11.2012, 16:21
Re: Estou tentando aprender :\ - by AmericanStyle'™ - 23.11.2012, 16:43
Re: Estou tentando aprender :\ - by Maklister - 23.11.2012, 17:05
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 19:35
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 23:47
Re: Estou tentando aprender :\ - by Dolby - 23.11.2012, 23:48
Re: Estou tentando aprender :\ - by Lucas-Fc - 23.11.2012, 23:50
Re: Estou tentando aprender :\ - by Dolby - 24.11.2012, 00:16
Re: Estou tentando aprender :\ - by tonisantolia - 24.11.2012, 00:52
Re: Estou tentando aprender :\ - by Jason` - 24.11.2012, 01:22

Forum Jump:


Users browsing this thread: 8 Guest(s)