29.11.2017, 17:17
PHP код:
// INCLUDES //
#include <a_samp>
#include <zcmd>
#include <DOF2>
// DEFINES //
#define DIALOG_REGISTRO 1
#define DIALOG_LOGAR 2
// ENUMS //
enum Informacoes
{
Senha,
Skin,
Dinheiro,
Trabalho,
};
// NEW'S//
new Player[MAX_PLAYERS][Informacoes];
new Erro[MAX_PLAYERS];
//Callbacks//
public 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)
{
new arquivo[40], name[MAX_PLAYER_NAME]; //'arquivo' uma string para a format | 'name' para pegar o nome do playerid
GetPlayerName(playerid, name, 32); //Pega o nome do playerid
format(arquivo, 40, "Contas/%s.ini", name); //Formata o arquivo com o nome do playerid
if(DOF2_FileExists(arquivo)) //Verifica se a pasta existe
{ //Caso existir, irб retornar a dialog de Login
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 //Caso o arquivo nгo exista
{ //Irб retornar a dialog de registro
ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "Registro", "Vocк ainda nгo й Registrado, digite uma senha para se registrar!", "Confirma", "Cancelar");
}
return 1;
}
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
new arquivo[40], name[MAX_PLAYER_NAME]; //'arquivo' uma string para a format | 'name' para pegar o nome do playerid
GetPlayerName(playerid, name, 32); //Para pegar o nome do playerid
format(arquivo, 40, "Contas/%s.ini", name); //Formata o arquivo com o nome do playerid
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 na pasta CONTAS
Player[playerid][Senha] = strval(inputtext); //Player[playerid][Senha] vai ser igual ao que ele digitar na dialog Registro
DOF2_CreateFile(arquivo); //Vai criar o arquvivo na pasta Contas
DOF2_SetInt(arquivo, "Senha", Player[playerid][Senha]); //Vai salvar a senha do playerid
DOF2_SetInt(arquivo, "Skin", Player[playerid][Skin]); //Vai salvar quantas vezes ele matou
DOF2_SetInt(arquivo, "Trabalho", Player[playerid][Trabalho]); //Vai salvar quantas vezes ele morreu
DOF2_SetInt(arquivo, "Dinheiro", Player[playerid][Dinheiro]); //Vai salvar o dinheiro dele
DOF2_SaveFile(); //E finalmente salvando o arquivo, sem essa funзгo o arquivo nгo serб salvo!
//Retornando a dialog de Login ao player no final para ele logar no server
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
{ //Retorna a dialog de Login novamente para ele digitar NЪMEROS
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
{ //Caso for true, ira verificar se o que ele digitar serб a mesma senha que ele se registrou anteriormente
Player[playerid][Senha] = DOF2_GetInt(arquivo, "Senha"); //Pega a senha do jogador no arquivo da conta
if(strval(inputtext) == Player[playerid][Senha]) //Se o que ele digitar for igual ao valor que carregou aqui em cima /\
{
Player[playerid][Trabalho] = DOF2_GetInt(arquivo, "Trabalho"); //Pega quantos ele morreu no arquivo
Player[playerid][Dinheiro] = DOF2_GetInt(arquivo, "Dinheiro"); //Pega o dinheiro e iguala ao Player[playerid][Dinheiro]
GivePlayerMoney(playerid, Player[playerid][Dinheiro]); //Da o dinheiro carregado acima
Player[playerid][Skin] = DOF2_GetInt(arquivo, "Skin"); //Pega a skin dele
SetPlayerSkin(playerid, Player[playerid][Skin]);
SpawnPlayer(playerid); //Spawna o player
}
else //Caso ele digitar a senha errada
{
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");
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, "Sua conta estб banida por errar 5 vezes a sua senha, contacte o Admin para retirar seu Ban!");
Ban(playerid);
return 1;
}
}
}
return 1;
}
C:\Users\Ailton\Desktop\PAWNO\gamemodes\Gamemodese mnome.pwn(150) : error 049: invalid line continuation
C:\Users\Ailton\Desktop\PAWNO\gamemodes\Gamemodese mnome.pwn(152) : warning 217: loose indentation
C:\Users\Ailton\Desktop\PAWNO\gamemodes\Gamemodese mnome.pwn(15 : warning 217: loose indentation
C:\Users\Ailton\Desktop\PAWNO\gamemodes\Gamemodese mnome.pwn(15 : error 029: invalid expression, assumed zero
C:\Users\Ailton\Desktop\PAWNO\gamemodes\Gamemodese mnome.pwn(170) : warning 217: loose indentation
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.