Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Includes
- #include <a_samp>
- #include <zcmd>
- #include DOF2
- #include sscanf
- //Dialogs & Defines
- #define tr1 222
- #define tr2 223
- #define REGISTRO 1
- #define LOGIN 2
- #define CONTAS "Players/%s.ini"
- #define function
- //Variaveis
- new mCoins[MAX_PLAYERS],EditGive[MAX_PLAYERS],Logou[MAX_PLAYERS],EscolhaV[MAX_PLAYERS],MEGAString[3200],attcoins[MAX_PLAYERS],stringglobal[70];
- new PlayerText:Textdraw0[MAX_PLAYERS];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- }
- #endif
- public OnPlayerRequestClass(playerid, classid)
- {
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- new String[100];
- format(String, sizeof(String), CONTAS, Nome);
- if(!DOF2_FileExists(String))
- {
- format(String, sizeof(String), "{FF6347}Olá %s {9C9C9C}Você Ainda Não Tem Uma Conta, Digite Uma Senha Para Continuar", Nome);
- ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "Registro", String, "Registrar", "Cancelar");
- }
- else
- {
- format(String, sizeof(String), "{FF6347}Olá %s {9C9C9C}Você Já Tem Uma Conta, Digite Sua Senha Para Logar-Se", Nome);
- ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- CarregarPlayer(playerid);
- Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 60.000000, 327.039978, "Coins ~r~ 0");
- PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.423599, 1.308799);
- PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawColor(playerid, Textdraw0[playerid], -1);
- PlayerTextDrawSetShadow(playerid, Textdraw0[playerid], 0);
- PlayerTextDrawSetOutline(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawBackgroundColor(playerid, Textdraw0[playerid], 51);
- PlayerTextDrawFont(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawSetProportional(playerid, Textdraw0[playerid], 1);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SalvarPlayer(playerid);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Sistema Criado por Media_Wallker");
- SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Para ver os Comandos use /ajuda");
- PlayerTextDrawShow(playerid, Textdraw0[playerid]);
- return 1;
- }
- forward atualizartxd(playerid);
- public atualizartxd(playerid)
- {
- format(stringglobal,sizeof(stringglobal),"Coins ~b~%d",mCoins[playerid]);
- PlayerTextDrawSetString(playerid, Textdraw0[playerid], stringglobal);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == REGISTRO)
- {
- if(response)
- {
- if(!strlen(inputtext))
- {
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- new String[100];
- format(String, sizeof(String), "{FF6347}Olá %s {9C9C9C}Você Ainda Não Tem Uma Conta, Digite Uma Senha Para Continuar", Nome);
- ShowPlayerDialog(playerid, REGISTRO, DIALOG_STYLE_PASSWORD, "{FF6347}Registro", String, "Registrar", "Cancelar");
- SendClientMessage(playerid,0x1E90FFAA,"{9C9C9C}Senha invalida, digite uma senha válida");
- return 1;
- }
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- new String[100];
- format(String, sizeof(String), CONTAS, Nome);
- DOF2_CreateFile(String);
- DOF2_SetString(String,"Senha",inputtext);
- DOF2_SetInt(String,"Dinheiro",0);
- DOF2_SetInt(String,"Vida", 100);
- DOF2_SetInt(String,"Colete", 100);
- DOF2_SetInt(String,"Logou",0);
- DOF2_SetInt(String,"Coising",0);
- ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "{FF6347}Login", "{9C9C9C}Pronto você se registrou agora digite Sua Senha Para Logar-Se", "Logar", "Cancelar");
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "{9C9C9C}Você não quis se registrar, por este motivo sera Kickado");
- Kick(playerid);
- return 1;
- }
- }
- if(dialogid == LOGIN)
- {
- if(response)
- {
- if(!strlen(inputtext))
- {
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- new String[100];
- format(String, sizeof(String), "{FF6347}Olá %s {9C9C9C}Você Já Tem Uma Conta, Digite Sua Senha Para Logar-Se", Nome);
- ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
- SendClientMessage(playerid,0x1E90FFAA,"OBS:Senha incorreta tente novamente");
- return 1;
- }
- new Nome[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Nome, sizeof(Nome));
- new String[100];
- format(String, sizeof(String), CONTAS, Nome);
- if(!strcmp(inputtext,DOF2_GetString(String,"Senha"),false))
- {
- CarregarPlayer(playerid);
- Logou[playerid]++;
- SendClientMessage(playerid,0x00FF00AA,"Conectado com Sucesso");
- SpawnPlayer(playerid);
- return 1;
- }
- else
- {
- SendClientMessage(playerid,0x00FF00AA,"Senha incorreta digite-a novamente");
- format(String, sizeof(String), "Olá %s você já tem uma conta, digite sua senha para logar-se", Nome);
- ShowPlayerDialog(playerid, LOGIN, DIALOG_STYLE_PASSWORD, "Login", String, "Logar", "Cancelar");
- }
- return 1;
- }
- else
- {
- SendClientMessage(playerid, 0xFF0000AA, "Você não quis se logar, por este motivo será Kickado");
- Kick(playerid);
- return 1;
- }
- }
- if(dialogid == 2316)
- {
- if(response)
- {
- new Float:pp;
- new Float:ppp;
- new Float:pppp;
- new Float:ppppp;
- if(listitem == 0)
- {
- if(mCoins[playerid] < 1000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Sanchez por 1.000 Coins");
- GetPlayerPos(playerid, pp,ppp,pppp);
- GetPlayerFacingAngle(playerid, ppppp);
- CreateVehicle(468, pp,ppp,pppp,ppppp, -1, -1, -1);
- mCoins[playerid] -= 1000;
- }
- if(listitem == 1)
- {
- if(mCoins[playerid] < 5000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma NRG-500 por 5000 Coins");
- GetPlayerPos(playerid, pp,ppp,pppp);
- GetPlayerFacingAngle(playerid, ppppp);
- CreateVehicle(522, pp,ppp,pppp,ppppp, -1, -1, -1);
- mCoins[playerid] -= 5000;
- }
- if(listitem == 2)
- {
- if(mCoins[playerid] < 5000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Buffalo por 5000 Coins");
- GetPlayerPos(playerid, pp,ppp,pppp);
- GetPlayerFacingAngle(playerid, ppppp);
- CreateVehicle(402, pp,ppp,pppp,ppppp, -1, -1, -1);
- mCoins[playerid] -= 5000;
- }
- if(listitem == 3)
- {
- if(mCoins[playerid] < 10000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Super-GT por 10000 Coins");
- GetPlayerPos(playerid, pp,ppp,pppp);
- GetPlayerFacingAngle(playerid, ppppp);
- CreateVehicle(506, pp,ppp,pppp,ppppp, -1, -1, -1);
- mCoins[playerid] -= 10000;
- }
- if(listitem == 4)
- {
- if(mCoins[playerid] < 9000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Turismo por 9000 Coins");
- GetPlayerPos(playerid, pp,ppp,pppp);
- GetPlayerFacingAngle(playerid, ppppp);
- CreateVehicle(451, pp,ppp,pppp,ppppp, -1, -1, -1);
- mCoins[playerid] -= 9000;
- }
- if(listitem == 5)
- {
- if(mCoins[playerid] < 15000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Jetpack por 15000 Coins");
- SetPlayerSpecialAction(playerid, 2);
- mCoins[playerid] -= 15000;
- }
- }
- }
- if(dialogid == 2318)
- {
- if(response)
- {
- if(listitem == 0)
- {
- ShowPlayerDialog(playerid, 2316, 5, "Comprar Veiculos",
- "Veiculo\tPreço(Coins)\n\
- Sanchez\t{33AA33}€{FFFFFF}1.000 Coins\n\
- NRG-500\t{33AA33}€{FFFFFF}5.000 Coins\n\
- Buffalo\t{33AA33}€{FFFFFF}5.000 Coins\n\
- Super-GT\t{33AA33}€{FFFFFF}10.000 Coins\n\
- Turismo\t{33AA33}€{FFFFFF}9.000 Coins\n\
- Jetpack\t{33AA33}€{FFFFFF}15.000 Coins", "Selecionar", "Sair");
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, 2317, 5, "Comprar Armas",
- "Arma\tBalas\tPreço(Coins)\n\
- Deagle\t150\t{33AA33}€{FFFFFF}1.000 Coins\n\
- ShotGun\t160\t{33AA33}€{FFFFFF}2.000 Coins\n\
- MP5\t300\t{33AA33}€{FFFFFF}3.000 Coins\n\
- Ak-47\t450\t{33AA33}€{FFFFFF}4.000 Coins\n\
- Soco Ingês\t{FF0000}N/A\t{33AA33}€{FFFFFF}2.000 Coins", "Selecionar", "Sair");
- }
- if(listitem == 2)
- {
- ShowPlayerDialog(playerid, tr1, DIALOG_STYLE_INPUT, "[x] Transferencia", "» Digite abaixo o ID Do Player que você deseja transferir os coins", "Confirmar", "Cancelar");
- return 1;
- }
- }
- return 1;
- }
- if(dialogid == tr1)
- {
- if(response)
- {
- new ele = strval(inputtext);
- EditGive[playerid] = ele;
- if(IsPlayerConnected(ele))
- {
- if(ele != INVALID_PLAYER_ID)
- {
- ShowPlayerDialog(playerid, tr2, DIALOG_STYLE_INPUT,"[x] Transferencia","» Digite abaixo o Valor que você deseja transferir","Confirmar","Cancelar");
- }
- }
- else
- {
- SendClientMessage(playerid, -1, "ERRO:Jogador Offline");
- ShowPlayerDialog(playerid, tr1, DIALOG_STYLE_INPUT, "[x] Transferencia", "» Digite abaixo o ID Do Player que você deseja transferir os coins", "Confirmar", "Cancelar");
- }
- }
- return 1;
- }
- if(dialogid == tr2)
- {
- if(response)
- {
- new quantidade = strval(inputtext);
- new entregar = EditGive[playerid];
- if(quantidade > mCoins[playerid])
- {
- SendClientMessage(playerid, -1, "Você não tem coins suficiente para está Transferência ! ");
- EscolhaV[playerid] = 0;
- return 1;
- }
- if(quantidade <= 0)
- {
- EscolhaV[playerid] = 0;
- return 1;
- }
- MEGAString[0] = EOS;
- new string[256];
- TakeCoins(playerid,quantidade);
- GiveCoins(entregar,quantidade);
- format(string, sizeof string, "(-- Você Recebeu uma transferência no total de %d Coins do Jogador [ID:%d]%s--)", quantidade,playerid,PlayerName(playerid));
- SendClientMessage(entregar, -1, string);
- SendClientMessage(entregar, -1, "(----OBS:Tire uma ScreenShot Apertando a Tecla F8 Se For Preciso Provar Algo----)");
- format(string, sizeof string, "(-- Você Transferiu %d Coins para o Jogador [ID:%d]%s!--)", quantidade,entregar,PlayerName(entregar));
- SendClientMessage(playerid, -1, string);
- SendClientMessage(playerid, -1, "(----OBS:Tire uma ScreenShot Apertando a Tecla F8 Se For Preciso Provar Algo----)");
- format(string, sizeof(string), "(-- O Jogador %s Transferiu %d Coins para o Jogador %s.--)",PlayerName(playerid),quantidade,PlayerName(entregar));
- EditGive[playerid] = 0;
- }
- return 1;
- }
- if(dialogid == 2317)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(mCoins[playerid] < 1000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- GivePlayerWeapon(playerid, 24, 150);
- mCoins[playerid] -= 1000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Deagle com 150 Balas");
- }
- if(listitem == 1)
- {
- if(mCoins[playerid] < 2000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- GivePlayerWeapon(playerid, 25, 160);
- mCoins[playerid] -= 2000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma ShotGun com 160 Balas");
- }
- if(listitem == 2)
- {
- if(mCoins[playerid] < 3000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- GivePlayerWeapon(playerid, 29, 300);
- mCoins[playerid] -= 3000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma MP5 com 300 Balas");
- }
- if(listitem == 3)
- {
- if(mCoins[playerid] < 4000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- GivePlayerWeapon(playerid, 30, 450);
- mCoins[playerid] -= 4000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma AK47 com 450 Balas");
- }
- if(listitem == 4)
- {
- if(mCoins[playerid] < 2000) return SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- GivePlayerWeapon(playerid, 1, 1);
- mCoins[playerid] -= 2000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Soco Inglês");
- }
- }
- }
- return 1;
- }
- function GiveCoins(playerid,valor)
- {
- new antes = mCoins[playerid];
- mCoins[playerid] = antes+valor;
- return true;
- }
- function TakeCoins(playerid,valor)
- {
- new antes = mCoins[playerid];
- mCoins[playerid] = antes-valor;
- return true;
- }
- CMD:darcoins(playerid, params[])
- {
- new para1, level, giveplayer[MAX_PLAYER_NAME], sendername[MAX_PLAYER_NAME];
- if(sscanf(params, "ud", para1, level))
- {
- SendClientMessage(playerid, -1, "{FF6347}USE:{9C9C9C} /darcoins [id] [quantia]");
- return 1;
- }
- GetPlayerName(para1, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- if(IsPlayerConnected(para1))
- {
- if(IsPlayerAdmin(playerid))
- {
- if(para1 != INVALID_PLAYER_ID)
- {
- new string[128];
- format(string, sizeof string, "Você deu R$%d para %s", level, giveplayer);
- SendClientMessage(playerid, -1, string);
- format(string, sizeof string, "O Admin %s te deu R$%d", sendername, level);
- SendClientMessage(para1, -1, string);
- GiveCoins(para1, level);
- }
- }
- }
- return 1;
- }
- function CarregarPlayer(playerid){
- new Arquivo[70];
- attcoins[playerid] = SetTimerEx("atualizartxd", 1000, true, "i", playerid);
- format(Arquivo, sizeof(Arquivo), CONTAS, PlayerName(playerid));
- if(DOF2_FileExists(Arquivo))
- {
- for(new i = 0; i != MAX_PLAYERS; ++i){
- mCoins[playerid] = DOF2_GetInt(Arquivo,"Coins");
- GivePlayerMoney(playerid, DOF2_GetInt(Arquivo,"Dinheiro"));
- SetPlayerHealth(playerid, DOF2_GetInt(Arquivo,"Vida"));
- SetPlayerArmour(playerid, DOF2_GetInt(Arquivo,"Colete"));
- Logou[playerid] = DOF2_GetInt(Arquivo, "Logou");
- }
- }
- return 1;
- }
- function SalvarPlayer(playerid){
- new Arquivo[70];
- new Float:Vida;
- new Float:Colete;
- GetPlayerHealth(playerid, Vida);
- GetPlayerArmour(playerid, Colete);
- format(Arquivo, sizeof(Arquivo), CONTAS, PlayerName(playerid));
- for(new i = 0; i != MAX_PLAYERS; i++)
- {
- DOF2_SetInt(Arquivo,"Coins",mCoins[playerid]);
- DOF2_SetFloat(Arquivo,"Vida", Vida);
- DOF2_SetFloat(Arquivo,"Colete", Colete);
- DOF2_SetInt(Arquivo,"Dinheiro", GetPlayerMoney(playerid));
- DOF2_SetInt(Arquivo,"Logou", Logou[playerid]);
- }
- DOF2_SaveFile();
- return 1;
- }
- function PlayerName(playerid)
- {
- new Name[MAX_PLAYER_NAME];
- GetPlayerName(playerid, Name, sizeof Name);
- return Name;
- }
- CMD:comprar(playerid)
- {
- new string[1024];
- format(string, sizeof string, "{00FFFF} » {FFFFFF}Comprar Veículos\n{00FFFF} » {FFFFFF}Comprar Armas\n{00FFFF} » {FFFFFF}Transferir Coins");
- ShowPlayerDialog(playerid, 2318, DIALOG_STYLE_LIST, "Menu Coins",string,"Selecionar", "Sair");
- return 1;
- }
- CMD:ajuda(playerid) return SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}/comprar,/darcoins");
Advertisement
Add Comment
Please, Sign In to add comment