Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <DOF2>
- #include <Pawn.CMD>
- #include <Sscanf2>
- // DIALOGS
- #define DIALOG_ENTRADA 0
- #define DIALOG_REGISTRO 1
- #define DIALOG_LOGIN 2
- // CORES
- #define Vermelho 0xFF0000AA
- #define Amarelo 0xFFFF00AA
- #define Azul 0x33AAFFAA
- // ENUNS
- enum p_Info
- {
- Nome[24],
- Dinheiro,
- Procurado,
- Level,
- Skin,
- Matou,
- Morreu
- };
- new Player[MAX_PLAYERS][p_Info];
- // NEWS
- new String[128];
- new File[35];
- main()
- {
- print("\nGAMEMODE - RPG\n\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("RPG");
- AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- return 1;
- }
- public OnGameModeExit()
- {
- DOF2::Exit();
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- ShowPlayerDialog(playerid, DIALOG_ENTRADA, DIALOG_STYLE_MSGBOX, "ENTRADA", "Bem-vindo(a)", "Entrar", "Sair");
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- GetPlayerName(playerid, Player[playerid][Nome], 24);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- Salvar(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- Player[killerid][Matou]++;
- Player[playerid][Morreu]++;
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- 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 == DIALOG_ENTRADA)
- {
- if(!response)
- return Kick(playerid);
- if(!DOF2::FileExists(Conta(playerid)))
- {
- ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "CONTA", "Insira uma senha para Registrar-se.", "Registrar", "Sair");
- }
- else
- {
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", "Insira uma senha para Logar-se.", "Logar", "Sair");
- }
- return 1;
- }
- if(dialogid == DIALOG_REGISTRO)
- {
- if(!response)
- return Kick(playerid);
- if(strlen(inputtext) < 5 || strlen(inputtext) > 20)
- {
- SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Insira uma senha antes de Registrar-se.");
- ShowPlayerDialog(playerid, DIALOG_REGISTRO, DIALOG_STYLE_INPUT, "CONTA", "Insira uma senha para Registrar-se.", "Registrar", "Sair");
- }
- else
- {
- DOF2::CreateFile(Conta(playerid));
- DOF2::SetString(Conta(playerid), "Senha", inputtext);
- DOF2::SetInt(Conta(playerid), "Dinheiro", Player[playerid][Dinheiro] = 5000);
- DOF2::SetInt(Conta(playerid), "Procurado", Player[playerid][Procurado] = 0);
- DOF2::SetInt(Conta(playerid), "Level", Player[playerid][Level] = 0);
- DOF2::SetInt(Conta(playerid), "Skin", Player[playerid][Skin] = 0);
- DOF2::SetInt(Conta(playerid), "Matou", Player[playerid][Matou] = 0);
- DOF2::SetInt(Conta(playerid), "Morreu", Player[playerid][Morreu] = 0);
- DOF2::SaveFile();
- GivePlayerMoney(playerid, Player[playerid][Dinheiro]);
- SetPlayerWantedLevel(playerid, Player[playerid][Procurado]);
- SetPlayerScore(playerid, Player[playerid][Level]);
- SetPlayerSkin(playerid, Player[playerid][Skin]);
- SendClientMessage(playerid, 0x33AAFFAA, "| INFO | Registrado(a) com sucesso!");
- }
- return 1;
- }
- if(dialogid == DIALOG_LOGIN)
- {
- if(!response)
- return Kick(playerid);
- if(!strlen(inputtext))
- {
- SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Insira uma senha antes de Registrar-se.");
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", "Insira uma senha para Logar-se.", "Logar", "Sair");
- return 1;
- }
- if(strcmp(inputtext, DOF2::GetString(Conta(playerid), "Senha"), true) == 0)
- {
- Player[playerid][Dinheiro] = DOF2::GetInt(Conta(playerid), "Dinheiro");
- Player[playerid][Procurado] = DOF2::GetInt(Conta(playerid), "Procurado");
- Player[playerid][Level] = DOF2::GetInt(Conta(playerid), "Level");
- Player[playerid][Skin] = DOF2::GetInt(Conta(playerid), "Skin");
- Player[playerid][Matou] = DOF2::GetInt(Conta(playerid), "Matou");
- Player[playerid][Morreu] = DOF2::GetInt(Conta(playerid), "Morreu");
- GivePlayerMoney(playerid, Player[playerid][Dinheiro]);
- SetPlayerWantedLevel(playerid, Player[playerid][Procurado]);
- SetPlayerScore(playerid, Player[playerid][Level]);
- SetPlayerSkin(playerid, Player[playerid][Skin]);
- SendClientMessage(playerid, 0x33AAFFAA, "| INFO | Logado(a) com sucesso!");
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "| ERRO | Senha Incorreta!");
- ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "CONTA", "Insira uma senha para Logar-se.", "Logar", "Sair");
- return 1;
- }
- return 1;
- }
- return 0;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- Conta(playerid)
- {
- format(File, sizeof(File), "Contas/%s.ini", Player[playerid][Nome]);
- return File;
- }
- Salvar(playerid)
- {
- if(DOF2::FileExists(Conta(playerid)))
- {
- Player[playerid][Dinheiro] = GetPlayerMoney(playerid);
- Player[playerid][Procurado] = GetPlayerWantedLevel(playerid);
- Player[playerid][Level] = GetPlayerScore(playerid);
- Player[playerid][Skin] = GetPlayerSkin(playerid);
- DOF2::SetInt(Conta(playerid), "Dinheiro", Player[playerid][Dinheiro]);
- DOF2::SetInt(Conta(playerid), "Procurado", Player[playerid][Procurado]);
- DOF2::SetInt(Conta(playerid), "Level", Player[playerid][Level]);
- DOF2::SetInt(Conta(playerid), "Skin", Player[playerid][Skin]);
- DOF2::SetInt(Conta(playerid), "Matou", Player[playerid][Matou]);
- DOF2::SetInt(Conta(playerid), "Morreu", Player[playerid][Morreu]);
- DOF2::SaveFile();
- Player[playerid][Dinheiro] = 0;
- Player[playerid][Procurado] = 0;
- Player[playerid][Level] = 0;
- Player[playerid][Skin] = 0;
- Player[playerid][Matou] = 0;
- Player[playerid][Morreu] = 0;
- }
- return 1;
- }
- // COMANDOS
- CMD:dargrana(playerid, params[])
- {
- new id, Money;
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem permissão!");
- if(sscanf(params, "ud", id, Money))
- return SendClientMessage(playerid, Vermelho, "| ERRO | Use: /DarGrana [id] [Grana]");
- if(!IsPlayerConnected(id))
- return SendClientMessage(playerid, Vermelho, "| ERRO | ID Inválido!");
- GivePlayerMoney(id, Money);
- SendClientMessage(playerid, Amarelo, "| INFO | Comando efetuado com sucesso!");
- format(String, sizeof(String), "| INFO-SERVER | O(A) Administrador(a) %s (%d) Deu para você {008000}$%d {33AAFF}de Dinheiro!", Player[playerid][Nome], playerid, Money);
- SendClientMessage(id, Azul, String);
- return 1;
- }
- CMD:darlevel(playerid, params[])
- {
- new id, Score;
- if(!IsPlayerAdmin(playerid))
- return SendClientMessage(playerid, Vermelho, "| ERRO | Você não tem permissão!");
- if(sscanf(params, "ud", id, Score))
- return SendClientMessage(playerid, Vermelho, "| ERRO | Use: /DarLevel [id] [Level]");
- if(!IsPlayerConnected(id))
- return SendClientMessage(playerid, Vermelho, "| ERRO | ID Inválido!");
- SetPlayerScore(id, Score);
- SendClientMessage(playerid, Amarelo, "| INFO | Comando efetuado com sucesso!");
- format(String, sizeof(String), "| INFO-SERVER | O(A) Administrador(a) %s (%d) Deu para você {FF0000}%d {33AAFF}de Level!", Player[playerid][Nome], playerid, Score);
- SendClientMessage(id, Azul, String);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment