Nao fiz desse jeito, sу que do jeito que fiz deu 1 erro, serб que pra corrigir precisa fzr dessa forma q tu falou? Olha ae:
PHP код:
// INCLUDES //
#include <a_samp>
#include <zcmd>
#include <DOF2>
// DEFINES //
#define DIALOG_REGISTRO 1
#define DIALOG_LOGAR 2
// ENUMS //
enum pInfo
{
pDinheiro,
pSkin,
pTrabalho,
pSenha,
};
// NEW'S//
new PlayerInfo[MAX_PLAYERS][pInfo];
new Erro[MAX_PLAYERS];
//Callbacks//
public OnPlayerConnect(playerid)
{
//Sistema carregar ou criar Conta//
new File[70], sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(File, sizeof(File), "%s.ini", sendername);
if(DOF2_FileExists(File))
{
PlayerInfo[playerid][pDinheiro] = DOF2_GetInt(File, "Dinheiro");
PlayerInfo[playerid][pSkin] = DOF2_GetInt(File, "Skin");
PlayerInfo[playerid][pTrabalho] = DOF2_GetInt(File, "Trabalho");
SendClientMessage(playerid, -1, "Perfil carregado com sucesso");
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк й Registrado, digite sua senha para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
}
else
{
DOF2_CreateFile(File);
DOF2_SetInt(File, "Skin", 97);
DOF2_SetInt(File, "Dinheiro", 5000);
DOF2_SetInt(File, "Trabalho", 0);
DOF2_SaveFile();
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Vocк ainda nгo й Registrado, digite uma senha para se registrar!", "Confirma", "Cancelar");
SendClientMessage(playerid, -1, "Perfil criado com sucesso. Aproveite!");
OnPlayerConnect(playerid);
//Veiculos
AddStaticVehicleEx(510,1255.8000000,-2044.3000000,59.2000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1255.1000000,-2044.2000000,59.2000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1254.2000000,-2044.3000000,59.3000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1253.5000000,-2044.3000000,59.3000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1252.7000000,-2044.3000000,59.3000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1269.4000000,-2044.9000000,58.8000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1270.2000000,-2045.0000000,58.8000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1270.8000000,-2045.0000000,58.8000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1271.3000000,-2045.0000000,58.8000000,0.0000000,-1,-1,15); //Mountain Bike
AddStaticVehicleEx(510,1271.9000000,-2045.0000000,58.8000000,0.0000000,-1,-1,15); //Mountain Bike
//Objetos e Interiores
CreateObject(1280,1279.3000000,-2036.3000000,58.4000000,0.0000000,0.0000000,0.0000000); //object(parkbench1) (1)
CreateObject(1280,1279.4000000,-2031.3000000,58.4000000,0.0000000,0.0000000,0.0000000); //object(parkbench1) (2)
CreateObject(1280,1279.2000000,-2017.8000000,58.3000000,0.0000000,0.0000000,0.0000000); //object(parkbench1) (3)
CreateObject(1280,1279.2000000,-2012.9000000,58.3000000,0.0000000,0.0000000,0.0000000); //object(parkbench1) (4)
CreateObject(1280,1243.3000000,-2035.3000000,59.3000000,0.0000000,0.0000000,180.0000000); //object(parkbench1) (5)
CreateObject(1280,1243.3000000,-2029.1000000,59.3000000,0.0000000,0.0000000,179.9950000); //object(parkbench1) (6)
CreateObject(1280,1243.6000000,-2018.0000000,59.3000000,0.0000000,0.0000000,180.0000000); //object(parkbench1) (7)
CreateObject(1280,1243.6000000,-2011.8000000,59.3000000,0.0000000,0.0000000,180.0000000); //object(parkbench1) (8)
CreateObject(7033,1262.7000000,-2038.2000000,62.9000000,0.0000000,0.0000000,360.0000000); //object(vgnhsegate02) (1)
CreateObject(14846,1560.2000000,-1676.9000000,-251.5000000,0.0000000,0.0000000,0.0000000); //object(int_ppol) (5)
CreateObject(1535,1545.0000000,-1682.9000000,-253.8999900,0.0000000,0.0000000,88.0000000); //object(gen_doorext14) (2)
CreateObject(1535,1545.0000000,-1680.0000000,-253.8999900,0.0000000,0.0000000,271.9950000); //object(gen_doorext14) (5)
CreateObject(1535,1545.0000000,-1682.9000000,-253.8999900,0.0000000,358.0000000,269.9950000); //object(gen_doorext14) (6)
CreateObject(2610,1549.1000000,-1692.1000000,-253.1000100,0.0000000,0.0000000,178.0000000); //object(cj_p_fileing2) (1)
CreateObject(2610,1549.6000000,-1692.1000000,-253.1000100,0.0000000,0.0000000,177.9950000); //object(cj_p_fileing2) (2)
CreateObject(2610,1552.8000000,-1692.0000000,-253.1000100,0.0000000,0.0000000,177.9950000); //object(cj_p_fileing2) (3)
CreateObject(2610,1553.2000000,-1692.0000000,-253.1000100,0.0000000,0.0000000,177.9950000); //object(cj_p_fileing2) (4)
CreateObject(1671,1552.9000000,-1686.7000000,-253.5000000,0.0000000,0.0000000,270.0000000); //object(swivelchair_a) (1)
CreateObject(2008,1551.7000000,-1687.7000000,-253.8999900,0.0000000,0.0000000,92.0000000); //object(officedesk1) (1)
CreateObject(2309,1550.4000000,-1688.0000000,-253.8999900,0.0000000,0.0000000,286.0000000); //object(med_office_chair2) (1)
CreateObject(1704,1546.0000000,-1691.0000000,-253.8999900,0.0000000,0.0000000,90.0000000); //object(kb_chair03) (1)
CreateObject(1704,1545.9000000,-1689.2000000,-253.8999900,0.0000000,0.0000000,90.0000000); //object(kb_chair03) (2)
CreateObject(1963,1551.2000000,-1692.1000000,-253.6000100,0.0000000,0.0000000,358.0000000); //object(est_desk) (1)
CreateObject(2330,1561.2000000,-1662.8000000,-252.5000000,0.0000000,0.0000000,0.0000000); //object(cj_bedroom1_w) (2)
CreateObject(2330,1563.7000000,-1663.7000000,-252.5000000,0.0000000,0.0000000,274.0000000); //object(cj_bedroom1_w) (3)
CreateObject(2605,1559.8000000,-1666.1000000,-252.1000100,0.0000000,0.0000000,0.0000000); //object(polce_desk1) (1)
CreateObject(2604,1561.9000000,-1670.4000000,-251.7000000,0.0000000,0.0000000,0.0000000); //object(cj_police_counter) (1)
CreateObject(2607,1559.8000000,-1665.3000000,-252.1000100,0.0000000,0.0000000,0.0000000); //object(polce_desk2) (2)
CreateObject(3109,1556.0000000,-1660.7000000,-251.3000000,0.0000000,0.0000000,90.0000000); //object(imy_la_door) (2)
CreateObject(2184,1550.2000000,-1668.5000000,-252.5000000,0.0000000,0.0000000,96.0000000); //object(med_office6_desk_2) (1)
CreateObject(1714,1551.0000000,-1666.6000000,-252.5000000,0.0000000,0.0000000,0.0000000); //object(kb_swivelchair1) (1)
CreateObject(1714,1551.0000000,-1668.7000000,-252.5000000,0.0000000,0.0000000,252.0000000); //object(kb_swivelchair1) (2)
CreateObject(2724,1548.3000000,-1667.6000000,-252.0000000,0.0000000,0.0000000,96.0000000); //object(lm_stripchair) (1)
CreateObject(3109,1564.0000000,-1656.8000500,-251.3000000,0.0000000,0.0000000,90.0000000); //object(imy_la_door) (3)
CreateObject(2634,1558.7000000,-1660.8000000,-251.3999900,0.0000000,0.0000000,180.0000000); //object(ab_vaultdoor) (1)
CreateObject(334,1558.7000000,-1657.2000000,-251.5000000,0.0000000,0.0000000,0.0000000); //object(1)
CreateObject(348,1559.1000000,-1657.2000000,-251.2000000,0.0000000,0.0000000,0.0000000); //object(2)
CreateObject(351,1559.6000000,-1657.2000000,-250.8999900,359.1660000,97.9570000,358.0580000); //object(3)
CreateObject(356,1559.2000000,-1657.2000000,-251.8000000,0.0000000,0.0000000,0.0000000); //object(4)
CreateObject(373,1558.2000000,-1659.4000000,-251.1000100,328.7360000,326.6860000,355.1660000); //object(5)
CreateObject(370,1557.8000000,-1659.0000000,-251.2000000,0.0000000,0.0000000,0.0000000); //object(7)
CreateObject(1974,1558.6000000,-1657.2000000,-250.8000000,0.0000000,0.0000000,340.0000000); //object(kb_golfball) (1)
CreateObject(1974,1559.8000000,-1657.2000000,-250.8000000,0.0000000,0.0000000,339.9990000); //object(kb_golfball) (2)
CreateObject(1974,1559.8000000,-1657.2000000,-252.1000100,0.0000000,0.0000000,339.9990000); //object(kb_golfball) (4)
CreateObject(1974,1558.4000000,-1657.2000000,-252.1000100,0.0000000,0.0000000,339.9990000); //object(kb_golfball) (6)
CreateObject(1974,1558.6000000,-1657.1000000,-252.1000100,0.0000000,0.0000000,339.9990000); //object(kb_golfball) (7)
CreateObject(3036,1567.7000000,-1701.1000000,-254.8000000,0.0000000,0.0000000,0.0000000); //object(ct_gatexr) (1)
CreateObject(3036,1558.7000000,-1701.0000000,-254.8000000,0.0000000,0.0000000,0.0000000); //object(ct_gatexr) (2)
CreateObject(3036,1563.2000000,-1701.0000000,-254.8000000,0.0000000,0.0000000,0.0000000); //object(ct_gatexr) (3)
CreateObject(3036,1572.2000000,-1701.1000000,-254.8000000,0.0000000,0.0000000,0.0000000); //object(ct_gatexr) (4)
CreateObject(2514,1553.4000000,-1695.7000000,-254.3000000,0.0000000,0.0000000,0.0000000); //object(cj_toilet1) (1)
}
return 1;
}
public OnPlayerDisconnect(playerid)
{
new File[70], sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(File, sizeof(File), "%s.ini", sendername);
DOF2_SetInt(File, "Skin", PlayerInfo[playerid][pSkin]);
DOF2_SetInt(File, "Dinheiro", PlayerInfo[playerid][pDinheiro]);
DOF2_SetInt(File, "Trabalho", PlayerInfo[playerid][pTrabalho]);
DOF2_SaveFile();
return 1;
}
public OnPlayerSpawn(playerid)
{
SetPlayerSkin(playerid, PlayerInfo[playerid][pSkin]);
GivePlayerMoney(playerid, PlayerInfo[playerid][pDinheiro]);
PlayerInfo[playerid][pTrabalho] = DOF2_GetInt("%.ini", "Trabalho");
}
public OnGameModeInit()
{
//Comandos Gerais//
UsePlayerPedAnims();
}
public OnGameModeExit()
{
DOF2_Exit();
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new File[70], sendername[MAX_PLAYER_NAME];
GetPlayerName(playerid, sendername, sizeof(sendername));
format(File, sizeof(File), "%s.ini", sendername);
if(dialogid == DIALOG_REGISTRO)
{
if(!strval(inputtext)) //Verifica se o player digitou LETRAS, caso for true
{ //Retorna a dialog de registro novamente para ele digitar NЪMEROS
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Digite apenas nъmeros!\nDigite sua senha novamente para se registrar!", "Confirma", "Cancelar");
return 1;
}
if(!response) //Verifica se ele clicar em 'Cancelar"
{ //Caso ele clicar em cancelar, irб retornar ao playerid KICK
Kick(playerid);
return 1;
}
else //Verifica se ele Confirma o Registro
{ //Caso for true, ira criar o arquivo
PlayerInfo[playerid][pSenha] = strval(inputtext);
DOF2_SetInt(File, "Senha", PlayerInfo[playerid][pSenha]);
DOF2_SaveFile();
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк se cadastrou, agora й sу logar com sua senha registrada!", "Confirma", "Cancelar");
}
}
if(dialogid == DIALOG_LOGAR)
{
if(!strval(inputtext)) //Verifica se o player digitou letras, caso for true
{
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Digite apenas nъmeros!\nDigite sua senha cadastrada para logar!\nSe errar 5 vezes sua conta serб banida!", "Confirma", "Cancelar");
return 1;
}
if(!response) //Verifica se ele clicar em 'Cancelar"
{ //Caso ele clicar em cancelar, irб retornar ao playerid KICK
Kick(playerid);
return 1;
}
else //Verifica se ele Confirma o Login
{
PlayerInfo[playerid][pSenha] = DOF2_GetInt(File, "Senha");
if(strval(inputtext) == PlayerInfo[playerid][pSenha])
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid, DIALOG_LOGAR, DIALOG_STYLE_PASSWORD, "Logar", "Vocк digitou sua senha errado, digite-a novamente para logar!\nSe errar 5 vezes irб ser kickado!", "Confirma", "Cancelar");
Erro[playerid]++; //O erro vai aumentar cada vez que ele errar
if(Erro[playerid] == 5) //Quando chegar а 5 vezes, irб retornar a msg e o Ban
{
SendClientMessage(playerid, -1, "Vocк foi kickado!");
Kick(playerid);
return 1;
}
}
}
return 1;
}