Código:
/*====================| Includes |====================*/
#include <a_samp>
#include <zcmd>
#include <sscanf>
#include <DOF2>
#include <streamer>
#pragma disablerecursion
/*====================| Variaveis Globais |====================*/
new StringContas[128];
new String[128];
/*====================| Defines Dialogs |====================*/
#define D_REGISTRO 10
#define D_LOGIN 20
#define DIALOG_VEHICLES 0
#define PlayAudioStreamForPlayer
#define StopAudioStreamForPlayer
#define DIALOG_STYLE_PASSWORD
#define StopAudioStreamForPlayer
#define p playerid
/*====================| Cores |====================*/
#define AMARELO 0xFFFF00FF
#define VERMELHO 0xFF0000AA
#define VERDE 0x00FF00FF
/*====================| Strcmp |====================*/
#define varGet(%0) getproperty(0,%0)
#define varSet(%0,%1) setproperty(0, %0, %1)
#define new_strcmp(%0,%1) \
(varSet(%0, 1), varGet(%1) == varSet(%0, 0))
/*====================| VARIAVEIS |====================*/
new VehSpawnP[MAX_PLAYERS];
new VerificarVeh[MAX_PLAYERS];
/*====================| ENUMS |====================*/
enum pInfo
{
pNivel
};
new PlayerInfo[MAX_PLAYERS][pInfo];
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
DisableInteriorEnterExits();
ShowPlayerMarkers(0);
//---------------SPAWN BIKE------------------//
AddStaticPickup(1239,1,1683.3743,-2324.5132,13.5469);
Create3DTextLabel("{FFFFFF}Spawn De Bike\nUse:/pbike",AMARELO,1683.3743,-2324.5132,13.5469,10.0,0);
return 1;
}
public OnGameModeExit()
{
DOF2_Exit();
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
format(StringContas, sizeof(StringContas), "Contas/%s.ini", pName(playerid));
if(!DOF2_FileExists(StringContas))
{
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) ao Servidor %s\n\nStatus da conta: {FF0000}Nao Registrada{FFFFFF}\nDigite uma senha para registrar sua conta", pName(playerid));
ShowPlayerDialog(playerid, D_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro Servidor", String, "Registrar", "Cancelar");
SendClientMessage(playerid, -1, "|INFO| Parece sua primeira vez aqui! Digite uma senha para registrar sua conta");
}
else
{
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) de volta %s\n\nStatus da conta: {00FF00}Registrada{FFFFFF}\nDigite sua senha para logar", pName(playerid));
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
}
SetSpawnInfo(playerid,26,0,1685.5962,-2334.7795,13.5469,353.5554, 0, 0, 0, 0, 0, 0);
return 1;
}
public OnPlayerConnect(playerid)
{
VehSpawnP[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
DestroyVehicle(VehSpawnP[playerid]);
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/mycommand", cmdtext, true, 10) == 0)
{
// Do something here
return 1;
}
return 0;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == D_REGISTRO)
{
if(response)
{
if(strlen(inputtext) >= 5 && strlen(inputtext) <= 20)
{
format(String, sizeof(String), "Contas/%s.ini", pName(playerid));
DOF2_CreateFile(String);
DOF2_SetString(String, "Senha", inputtext);
DOF2_SetInt(String, "Nivel", 0);
DOF2_SetInt(String, "Dinheiro", 1000);
DOF2_SetInt(String, "Skin",26);
DOF2_SaveFile();
for(new i; i < 20; i++)
{
SendClientMessage(playerid, -1, "");
}
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) %s\n\nStatus da conta: {00FF00}Registrada{FFFFFF}\nDigite sua senha para logar", pName(playerid));
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
SendClientMessage(playerid, -1, "|INFO| Voce Registrou sua conta com sucesso, Digite sua senha para logar");
}
else
{
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) ao Servidor %s\n\nStatus da conta: {FF0000}Nao Registrada{FFFFFF}\nDigite uma senha para registrar sua conta", pName(playerid));
ShowPlayerDialog(playerid, D_REGISTRO, DIALOG_STYLE_PASSWORD, "Registro Servidor", String, "Registrar", "Cancelar");
return SendClientMessage(playerid, VERMELHO, "|ERRO| Sua senha deve conter de 5 a 20 caracteres");
}
}
else
{
SendClientMessage(playerid, -1, "|INFO| Voce foi kickado automaticamente por ter cancelado o registro");
SetTimerEx("Kickar", 200, false, "d", playerid);
}
}
if(dialogid == D_LOGIN)
{
if(response)
{
if(strlen(inputtext) >= 5 && strlen(inputtext) <= 20)
{
format(String, sizeof(String), "Contas/%s.ini", pName(playerid));
if(new_strcmp(inputtext, DOF2_GetString(String, "Senha")))
{
SetPlayerScore(playerid, DOF2_GetInt(String, "Nivel"));
GivePlayerMoney(playerid, DOF2_GetInt(String, "Dinheiro"));
SetPlayerSkin(playerid, DOF2_GetInt(String, "Skin"));
SpawnPlayer(playerid);
}
else
{
SendClientMessage(playerid, VERMELHO, "|ERRO| Senha Incorreta");
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) de volta %s\n\nStatus da conta: {00FF00}Registrada{FFFFFF}\nDigite sua senha para logar", pName(playerid));
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
}
}
else
{
SendClientMessage(playerid, VERMELHO, "|ERRO| Senha incorreta");
format(String, sizeof(String), "{FFFFFF}Seja Bem-Vindo(a) %s\n\nStatus da conta: {00FF00}Registrada{FFFFFF}\nDigite sua senha para logar", pName(playerid));
ShowPlayerDialog(playerid, D_LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
}
}
else
{
SendClientMessage(playerid, -1, "|INFO| Voce foi kickado automaticamente por ter cancelado o login");
SetTimerEx("Kickar", 200, false, "d", playerid);
}
}
if(dialogid == DIALOG_VEHICLES)
{
if(listitem == 0)
{
if(VerificarVeh[playerid] == 0)
{
VehSpawnP[playerid] = AddStaticVehicle(510,1683.3743,-2324.5132,13.5469,0.0,8,20);
SendClientMessage(playerid,0xFF0080AA,"Voce Spawno Um Bicleta Publica");
PutPlayerInVehicle (playerid, VehSpawnP[playerid],0);
VerificarVeh[playerid] = 1;
}else{
SendClientMessage(playerid,0xFF0000AA,"Erro - Voce Ja Pegou Um Veiculo");
}
}
if(listitem == 1)
{
if(VerificarVeh[playerid] == 0)
{
VehSpawnP[playerid] = AddStaticVehicle(481,1683.3743,-2324.5132,13.5469,0.0,8,20);
SendClientMessage(playerid,0xFF0080AA,"Voce Spawno Uma Bicleta Publica");
PutPlayerInVehicle (playerid, VehSpawnP[playerid],0);
VerificarVeh[playerid] = 1;
}else{
SendClientMessage(playerid,0xFF0000AA,"Erro - Voce Ja Pegou Um Veiculo");
}
}
if(listitem == 2)
{
if(VerificarVeh[playerid] == 0)
{
VehSpawnP[playerid] = AddStaticVehicle(509,1683.3743,-2324.5132,13.5469,0.0,8,20);
SendClientMessage(playerid,0xFF0080AA,"Voce Spawno Uma Bicleta Publica");
PutPlayerInVehicle (playerid, VehSpawnP[playerid],0);
VerificarVeh[playerid] = 1;
}else{
SendClientMessage(playerid,0xFF0000AA,"Erro - Voce Ja Pegou Um Veiculo");
}
}
if(listitem == 3)
{
if(VerificarVeh[playerid] == 1)
{
DestroyVehicle(VehSpawnP[playerid]);
SendClientMessage(playerid,0xFF0080AA,"Voce Entregou O Veiculo");
VerificarVeh[playerid] = 0;
}else{
SendClientMessage(playerid,0xFF0000AA,"Erro - Voce Nao Pegou Um Veiculo");
}
}
}
return 1;
}
//=================COMANDOS PLAYER===============//
CMD:pbike(playerid)
{
if(IsPlayerInRangeOfPoint(playerid,2.0,1683.3743,-2324.5132,13.5469))
{
ShowPlayerDialog(playerid,DIALOG_VEHICLES,DIALOG_STYLE_LIST,"Veiculos:","Montain Bike\nBmx\nBike\nEntregar Veiculo","Confirmar","Cancelar");
}
return 1;
}
CMD:docs(playerid)
{
new string[500];
format(string, 500, "{FF0000}Titular: {FFFFFF}%s\n\n{FF0000}Nivel: {FFFFFF}%d\n\n{FF0000}Dinheiro: {FFFFFF}%d\n\n{FF0000}Procurado: {FFFFFF}%d\n\n", pName(playerid), PlayerInfo[playerid][pNivel], GetPlayerMoney(playerid), GetPlayerWantedLevel(playerid));
ShowPlayerDialog(playerid, 999, DIALOG_STYLE_MSGBOX, "RG", string, "OK", "Fechar");
return 1;
}
CMD:mostrardocs(playerid, params[])
{
new string[500], id;
if(sscanf(params, "d", id)) return SendClientMessage(playerid, VERMELHO, "Use /mostrarrg [ID]");
format(string, 500, "{FF0000}Titular: {FFFFFF}%s\n\n{FF0000}Nivel: {FFFFFF}%d\n\n{FF0000}Dinheiro: {FFFFFF}%d\n\n{FF0000}Procurado: {FFFFFF}%d\n\n", pName(playerid), PlayerInfo[playerid][pNivel], GetPlayerMoney(playerid), GetPlayerWantedLevel(playerid));
ShowPlayerDialog(id, 999, DIALOG_STYLE_MSGBOX, "RG", string, "OK", "Fechar");
return 1;
}
//=========================STOCKS E PUBLICS UNICAS============//
forward Kickar(playerid);
public Kickar(playerid)
{
Kick(playerid);
return 1;
}
stock pName(playerid)
{
new Nome[24];
GetPlayerName(playerid, Nome, sizeof(Nome));
return Nome;
}