public AtualizarStatus(playerid)
{
static arquivo[40], name[24];
GetPlayerName(playerid, name,sizeof(name));
format(arquivo, 40, "Contas/%s.ini", name);
if(DOF2_FileExists(arquivo))
{
DOF2_SetInt(arquivo,"Dinheiro",PlayerInfo[playerid][Dinheiro]);
DOF2_SetInt(arquivo,"Level",PlayerInfo[playerid][Level]);
SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
DOF2_SetInt(arquivo,"Admin",PlayerInfo[playerid][Admin]);
DOF2_SetInt(arquivo,"Membro",PlayerInfo[playerid][Membro]);
DOF2_SetInt(arquivo,"Lider",PlayerInfo[playerid][Lider]);
DOF2_SetInt(arquivo,"Respeito",PlayerInfo[playerid][Respeito]);
DOF2_SetInt(arquivo,"Tuto",PlayerInfo[playerid][Tuto]);
DOF2_SetInt(arquivo,"Banco",PlayerInfo[playerid][Banco]);
DOF2_SetInt(arquivo,"Matou",PlayerInfo[playerid][Matou]);
DOF2_SetInt(arquivo,"Morreu",PlayerInfo[playerid][Morreu]);
DOF2_SetInt(arquivo,"Drogas",PlayerInfo[playerid][Drogas]);
DOF2_SetInt(arquivo,"Profissao",PlayerInfo[playerid][Profissao]);
DOF2_SetInt(arquivo,"RespeitoR",PlayerInfo[playerid][RespeitoR]);
DOF2_SaveFile();
}
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
new arquivo[40], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, 32);
format(arquivo, 40, "Contas/%s.ini", name);
if(DOF2_FileExists(arquivo))
{
DOF2_SetInt(arquivo,"Dinheiro",PlayerInfo[playerid][Dinheiro]);
DOF2_SetInt(arquivo,"Level",PlayerInfo[playerid][Level]);
DOF2_SetInt(arquivo,"Admin",PlayerInfo[playerid][Admin]);
DOF2_SetInt(arquivo,"Membro",PlayerInfo[playerid][Membro]);
DOF2_SetInt(arquivo,"Lider",PlayerInfo[playerid][Lider]);
DOF2_SetInt(arquivo,"Respeito",PlayerInfo[playerid][Respeito]);
DOF2_SetInt(arquivo,"Tuto",PlayerInfo[playerid][Tuto]);
DOF2_SetInt(arquivo,"Banco",PlayerInfo[playerid][Banco]);
DOF2_SetInt(arquivo,"Matou",PlayerInfo[playerid][Matou]);
DOF2_SetInt(arquivo,"Morreu",PlayerInfo[playerid][Morreu]);
DOF2_SetInt(arquivo,"Drogas",PlayerInfo[playerid][Drogas]);
DOF2_SetInt(arquivo,"Profissao",PlayerInfo[playerid][Profissao]);
DOF2_SetInt(arquivo,"RespeitoR",PlayerInfo[playerid][RespeitoR]);
DOF2_SaveFile();
}
return 1;
}
No OnPlayerConnect coloque GivePlayerMoney(playerid, PlayerInfo[playerid][Dinheiro]); public AtualizarStatus(playerid) { static arquivo[40], name[24]; GetPlayerName(playerid, name,sizeof(name)); format(arquivo, 40, "Contas/%s.ini", name); if(DOF2_FileExists(arquivo)) { DOF2_SetInt(arquivo,"Dinheiro",PlayerInfo[playerid][Dinheiro]); DOF2_SetInt(arquivo,"Level",PlayerInfo[playerid][Level]); SetPlayerScore(playerid, PlayerInfo[playerid][Level]); DOF2_SetInt(arquivo,"Admin",PlayerInfo[playerid][Admin]); DOF2_SetInt(arquivo,"Membro",PlayerInfo[playerid][Membro]); DOF2_SetInt(arquivo,"Lider",PlayerInfo[playerid][Lider]); DOF2_SetInt(arquivo,"Respeito",PlayerInfo[playerid][Respeito]); DOF2_SetInt(arquivo,"Tuto",PlayerInfo[playerid][Tuto]); DOF2_SetInt(arquivo,"Banco",PlayerInfo[playerid][Banco]); DOF2_SetInt(arquivo,"Matou",PlayerInfo[playerid][Matou]); DOF2_SetInt(arquivo,"Morreu",PlayerInfo[playerid][Morreu]); DOF2_SetInt(arquivo,"Drogas",PlayerInfo[playerid][Drogas]); DOF2_SetInt(arquivo,"Profissao",PlayerInfo[playerid][Profissao]); DOF2_SetInt(arquivo,"RespeitoR",PlayerInfo[playerid][RespeitoR]); GivePlayerMoney(playerid, PlayerInfo[playerid][Dinheiro]); DOF2_SaveFile(); } return 1; }
//*******************Includes*****************************************
#include <a_samp>
#include <Dini>
//*********************Cores****************************************************
#define LARANJA 0xFF8C00AA
#define VERDE 0x33AA33AA
#define AMARELO 0xFFFF00AA
#define COLOR 0xFF0000AA
#define AZUL 0x33CCFFAA
#define AAZUL 0x2641FEAA
#define FILTERSCRIPT
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
//**********************News****************************************************
new Spawned[MAX_PLAYERS];
//**********************News****************************************************
public OnFilterScriptInit()
{
print("\n****||Rank System DKN||*******|Versгo:1.0|*******");
print("****||Agradecimentos: Dark PT Team e DraKoN||****\n");
if(!fexist("dinheiro.ini")) dini_Create("dinheiro.ini");
if(!fexist("WantedLevel.ini")) dini_Create("WantedLevel .ini");
if(!fexist("Color.ini")) dini_Create("Color .ini");
if(!fexist("scores.ini")) dini_Create("scores.ini");
SetTimer("ping", 1, 1000);
return 1;
}
//******************************************************************************
public OnPlayerConnect(playerid)
{
if(dini_Isset("Color.ini",PlayerName(playerid))) SetPlayerColor(playerid,dini_Int("Color.ini",PlayerName(playerid)));
if(dini_Isset("scores.ini",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("scores.ini",PlayerName(playerid)));
return 1;
}
//******************************************************************************
public OnPlayerDisconnect(playerid, reason)
{
dini_IntSet("Color.ini",PlayerName(playerid),GetPlayerColor (playerid));
dini_IntSet("scores.ini",PlayerName(playerid),GetPlayerScore(playerid));
Spawned[playerid] = 0;
return 1;
}
//******************************************************************************
public OnPlayerSpawn(playerid)
{
Spawned[playerid] = 1;
return 1;
}
//******************************************************************************
public OnPlayerDeath(playerid, killerid, reason)
{
}
//******************************************************************************
public OnPlayerText(playerid, text[])
{
return 1;
}
//**********************News****************************************************
public OnPlayerCommandText(playerid, cmdtext[])
{
new
cmd[256],
idx;
cmd = strtok(cmdtext, idx);
/*if(strcmp(cmd, "/rank", true) == 0)
{
new
ar[MAX_PLAYERS][2],
tmpsize;
tmpsize = fill ( ar );
process( ar , tmpsize );
CreateTop ( ar , tmpsize );
return 1;
}*/
return 0;
}
//**********************News****************************************************
forward ping();
public ping()
{
for ( new i = 0; i < MAX_PLAYERS; i++ )
{
if(GetPlayerPing(i) > 1000 && Spawned[i] == 1)
{
Kick(i);//Ping
}
}
return 1;
}
//*****************************************************************************
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}
//*****************************************************************************
stock PlayerName(playerid)
{
new Name[MAX_PLAYERS];
GetPlayerName(playerid, Name, sizeof(Name));
return Name;
}
//*****************************************************************************
stock fill ( array[][] )
{
new x_count;
for ( new g = 0; g < MAX_PLAYERS; g++ )
if ( IsPlayerConnected ( g ) )
{
x_count++;
array[g][1] = g;
array[g][0] = GetPlayerScore ( g );
}
return x_count;
}
//*****************************************************************************
stock process ( array[][] , size = sizeof ( array ) )
{
if ( size > 1 )
{
new
bool:flag,
tmpx;
do
{
flag = true;
for ( new i = size - 1; i > 0; i-- )
if ( array[i][0] < array[i - 1][0] )
{
tmpx = array[i][0];
array[i][0] = array[i - 1][0];
array[i - 1][0] = tmpx;
tmpx = array[i][1];
array[i][1] = array[i - 1][1];
array[i - 1][1] = tmpx;
flag = false;
}
}
while flag == false;
}
}
//*****************************************************************************
stock CreateTop ( array[][] , max , count = 10 )
{
new
str[64],
pln[24];
for ( new i = 0; i < ( ( max < count) ? max : count ); i++ )
{
GetPlayerName ( array[i][1] , pln , sizeof ( pln ) );
format( str , sizeof ( str ) , "%d.%s: %d" , i + 1 , pln , array[i][0] );
SendClientMessageToAll ( 0x33FF33AA , str );
}
return true;
}
Code:
No OnPlayerConnect coloque GivePlayerMoney(playerid, PlayerInfo[playerid][Dinheiro]); public AtualizarStatus(playerid) { static arquivo[40], name[24]; GetPlayerName(playerid, name,sizeof(name)); format(arquivo, 40, "Contas/%s.ini", name); if(DOF2_FileExists(arquivo)) { DOF2_SetInt(arquivo,"Dinheiro",PlayerInfo[playerid][Dinheiro]); DOF2_SetInt(arquivo,"Level",PlayerInfo[playerid][Level]); SetPlayerScore(playerid, PlayerInfo[playerid][Level]); DOF2_SetInt(arquivo,"Admin",PlayerInfo[playerid][Admin]); DOF2_SetInt(arquivo,"Membro",PlayerInfo[playerid][Membro]); DOF2_SetInt(arquivo,"Lider",PlayerInfo[playerid][Lider]); DOF2_SetInt(arquivo,"Respeito",PlayerInfo[playerid][Respeito]); DOF2_SetInt(arquivo,"Tuto",PlayerInfo[playerid][Tuto]); DOF2_SetInt(arquivo,"Banco",PlayerInfo[playerid][Banco]); DOF2_SetInt(arquivo,"Matou",PlayerInfo[playerid][Matou]); DOF2_SetInt(arquivo,"Morreu",PlayerInfo[playerid][Morreu]); DOF2_SetInt(arquivo,"Drogas",PlayerInfo[playerid][Drogas]); DOF2_SetInt(arquivo,"Profissao",PlayerInfo[playerid][Profissao]); DOF2_SetInt(arquivo,"RespeitoR",PlayerInfo[playerid][RespeitoR]); GivePlayerMoney(playerid, PlayerInfo[playerid][Dinheiro]); DOF2_SaveFile(); } return 1; } |
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new arquivo[40], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, 32);
format(arquivo, 40, "Contas/%s.ini", name);
if(dialogid == DIALOG_REGISTRO)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", "\nDigite sua senha novamente para se registrar!", "Confirma", "Cancelar");
return 1;
}
if(!response)
{
Kick(playerid);
return 1;
}
else
{
PlayerInfo[playerid][Senha] = AlcaponeKey(inputtext);
DOF2_CreateFile(arquivo);
DOF2_SetInt(arquivo, "Senha", PlayerInfo[playerid][Senha]);
DOF2_SetInt(arquivo, "Level", PlayerInfo[playerid][Level] = 2);
DOF2_SetInt(arquivo, "Admin", PlayerInfo[playerid][Admin] = 0);
DOF2_SetInt(arquivo, "Dinheiro", PlayerInfo[playerid][Dinheiro] = 1900);
DOF2_SetInt(arquivo, "Membro", PlayerInfo[playerid][Membro] = 0);
DOF2_SetInt(arquivo, "Lider", PlayerInfo[playerid][Lider] = 0);
DOF2_SetInt(arquivo, "Respeito", PlayerInfo[playerid][Respeito] = 0);
DOF2_SetInt(arquivo, "Tuto", PlayerInfo[playerid][Tuto] = 0);
DOF2_SetInt(arquivo, "Banco", PlayerInfo[playerid][Banco] = 500);
DOF2_SetInt(arquivo, "Matou", PlayerInfo[playerid][Matou] = 0);
DOF2_SetInt(arquivo, "Morreu", PlayerInfo[playerid][Morreu] = 0);
DOF2_SetInt(arquivo, "Drogas", PlayerInfo[playerid][Drogas] = 0);
DOF2_SetInt(arquivo, "Profissao", PlayerInfo[playerid][Profissao] = 0);
DOF2_SetInt(arquivo, "RespeitoR", PlayerInfo[playerid][RespeitoR] = 0);
new year, month, day;
getdate(year, month, day);
DOF2_SaveFile();
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк se registrou, agora й sу logar.", "Confirma", "Cancelar");
}
}
if(!response)
{
Kick(playerid);
return 1;
}
if(dialogid == DIALOG_LOGAR)
{
if(!strlen(inputtext))
{
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "\nDigite sua senha cadastrada para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
return 1;
}
if(!response)
{
Kick(playerid);
return 1;
}
else
{
PlayerInfo[playerid][Senha] = DOF2_GetInt(arquivo, "Senha");
if(AlcaponeKey(inputtext) == PlayerInfo[playerid][Senha])
{
PlayerInfo[playerid][Level] = DOF2_GetInt(arquivo, "Level");
SetPlayerScore(playerid, PlayerInfo[playerid][Level]);
PlayerInfo[playerid][Admin] = DOF2_GetInt(arquivo, "Admin");
PlayerInfo[playerid][Membro] = DOF2_GetInt(arquivo, "Membro");
PlayerInfo[playerid][Lider] = DOF2_GetInt(arquivo, "Lider");
PlayerInfo[playerid][Respeito] = DOF2_GetInt(arquivo, "Respeito");
PlayerInfo[playerid][Banco] = DOF2_GetInt(arquivo, "Banco");
PlayerInfo[playerid][Matou] = DOF2_GetInt(arquivo, "Matou");
PlayerInfo[playerid][Morreu] = DOF2_GetInt(arquivo, "Morreu");
PlayerInfo[playerid][Drogas] = DOF2_GetInt(arquivo, "Drogas");
PlayerInfo[playerid][Profissao] = DOF2_GetInt(arquivo, "Profissao");
PlayerInfo[playerid][RespeitoR] = DOF2_GetInt(arquivo, "RespeitoR");
PlayerInfo[playerid][Dinheiro] = DOF2_GetInt(arquivo, "Dinheiro");
GivePlayerMoney(playerid, DOF2_GetInt(arquivo, "Dinheiro"));
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк digitou sua senha errado, digite-a novamente para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
}
}
}
DOF2_SetInt(arquivo,"Dinheiro",GetPlayerMoney(playerid));
GivePlayerMoney(playerid,DOF2_SetInt(arquivo,"Dinheiro"));