Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*sistema feito totalmente por media
- não retire os créditos !
- Primeira release do Sistema
- Falta Fazer:
- Salvamento do Coins
- que está incompleto
- e adicionar um veículo a mas para testes
- */
- #include <a_samp>
- #include <zcmd>
- #include DOF2
- #include sscanf
- #define Pasta_Coins "Coins/%s.ini"
- enum mInfo
- {
- mCoins
- };
- new PlayerText:Textdraw0[MAX_PLAYERS];
- new PlayerInfo[MAX_PLAYERS][mInfo];
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\nSistema de mCoins Carregado com Sucesso\n");
- print(" Sistema feito por Media_Wallker");
- print("Não Retire os Créditos\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- return 1;
- }
- #else
- main()
- {
- }
- #endif
- public OnPlayerConnect(playerid)
- {
- CarregarPlayer(playerid);
- Textdraw0[playerid] = CreatePlayerTextDraw(playerid, 532.799865, 111.253349, "Coins: ~w~0");
- PlayerTextDrawLetterSize(playerid, Textdraw0[playerid], 0.449999, 1.600000);
- PlayerTextDrawAlignment(playerid, Textdraw0[playerid], 1);
- PlayerTextDrawColor(playerid, Textdraw0[playerid], 16777215);
- 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;
- }
- public OnPlayerUpdate(playerid)
- {
- new Coinsstr[128];
- format(Coinsstr,sizeof(Coinsstr),"Coins ~b~%d",PlayerInfo[playerid][mCoins]);
- PlayerTextDrawSetString(playerid, Textdraw0[playerid], Coinsstr);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == 2316)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(PlayerInfo[playerid][mCoins] < 1000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- new Float:p[4];
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Sanchez por 1.000 Coins");
- GetPlayerPos(playerid, p[0],p[1],p[2]);
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(468, p[0],p[1],p[2],p[3], -1, -1, -1);
- PlayerInfo[playerid][mCoins] -= 1000;
- }
- if(listitem == 1)
- {
- if(PlayerInfo[playerid][mCoins] < 5000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- new Float:p[4];
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma NRG-500 por 5000 Coins");
- GetPlayerPos(playerid, p[0],p[1],p[2]);
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(522, p[0],p[1],p[2],p[3], -1, -1, -1);
- PlayerInfo[playerid][mCoins] -= 5000;
- }
- if(listitem == 2)
- {
- if(PlayerInfo[playerid][mCoins] < 5000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- new Float:p[4];
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Buffalo por 5000 Coins");
- GetPlayerPos(playerid, p[0],p[1],p[2]);
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(402, p[0],p[1],p[2],p[3], -1, -1, -1);
- PlayerInfo[playerid][mCoins] -= 5000;
- }
- if(listitem == 3)
- {
- if(PlayerInfo[playerid][mCoins] < 10000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- new Float:p[4];
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Super-GT por 10000 Coins");
- GetPlayerPos(playerid, p[0],p[1],p[2]);
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(506, p[0],p[1],p[2],p[3], -1, -1, -1);
- PlayerInfo[playerid][mCoins] -= 10000;
- }
- if(listitem == 4)
- {
- if(PlayerInfo[playerid][mCoins] < 9000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- new Float:p[4];
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Turismo por 9000 Coins");
- GetPlayerPos(playerid, p[0],p[1],p[2]);
- GetPlayerFacingAngle(playerid, p[3]);
- CreateVehicle(451, p[0],p[1],p[2],p[3], -1, -1, -1);
- PlayerInfo[playerid][mCoins] -= 9000;
- }
- if(listitem == 5)
- {
- if(PlayerInfo[playerid][mCoins] < 15000)
- {
- SendClientMessage(playerid, -1, "Você não possui coins o suficiente");
- return 1;
- }
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Jetpack por 15000 Coins");
- SetPlayerSpecialAction(playerid, 2);
- PlayerInfo[playerid][mCoins] -= 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");
- }
- }
- return 1;
- }
- if(dialogid == 2317)
- {
- if(response)
- {
- if(listitem == 0)
- {
- if(PlayerInfo[playerid][mCoins] < 1000)
- {
- SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
- return 1;
- }
- GivePlayerWeapon(playerid, 24, 150);
- PlayerInfo[playerid][mCoins] -= 1000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma Deagle com 150 Balas");
- }
- if(listitem == 1)
- {
- if(PlayerInfo[playerid][mCoins] < 2000)
- {
- SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
- return 1;
- }
- GivePlayerWeapon(playerid, 25, 160);
- PlayerInfo[playerid][mCoins] -= 2000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma ShotGun com 160 Balas");
- }
- if(listitem == 2)
- {
- if(PlayerInfo[playerid][mCoins] < 3000)
- {
- SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
- return 1;
- }
- GivePlayerWeapon(playerid, 29, 300);
- PlayerInfo[playerid][mCoins] -= 3000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma MP5 com 300 Balas");
- }
- if(listitem == 3)
- {
- if(PlayerInfo[playerid][mCoins] < 4000)
- {
- SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
- return 1;
- }
- GivePlayerWeapon(playerid, 30, 450);
- PlayerInfo[playerid][mCoins] -= 4000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou uma AK47 com 450 Balas");
- }
- if(listitem == 4)
- {
- if(PlayerInfo[playerid][mCoins] < 2000)
- {
- SendClientMessage(playerid, -1, "Suas Coins São Insuficientes para Realizar a Compra.");
- return 1;
- }
- GivePlayerWeapon(playerid, 1, 1);
- PlayerInfo[playerid][mCoins] -= 2000;
- SendClientMessage(playerid, -1, "{FF6347}Comprado:{9C9C9C}Você comprou um Soco Inglês");
- }
- }
- }
- return 1;
- }
- stock GiveCoins(playerid,valor)
- {
- new antes = PlayerInfo[playerid][mCoins];
- PlayerInfo[playerid][mCoins] = antes+valor;
- return true;
- }
- CMD:darcoins(playerid, params[])
- {
- new para1;
- new level;
- if(sscanf(params, "ud", para1, level))
- {
- SendClientMessage(playerid, -1, "{FF6347}USE:{9C9C9C} /darcoins [id] [quantia]");
- return 1;
- }
- new giveplayer[MAX_PLAYER_NAME];
- new sendername[MAX_PLAYER_NAME];
- 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;
- }
- stock CarregarPlayer(playerid){
- new Arquivo[50];
- format(Arquivo, sizeof Arquivo, "Coins/%s.ini", PlayerName(playerid));
- if(DOF2_FileExists(Arquivo))
- {
- new str[22];
- for(new i = 0; i != MAX_PLAYERS; ++i){
- format(str, sizeof str, "%d", i);
- PlayerInfo[playerid][mCoins] = DOF2_GetInt(Arquivo, str);
- }
- }
- return 1;
- }
- stock SalvarPlayer(playerid){
- new Arquivo[50];
- format(Arquivo, sizeof Arquivo, "Coins/%s.ini", PlayerName(playerid));
- new str[22];
- for(new i = 0; i != MAX_PLAYERS; i++)
- {
- format(str, sizeof str, "Coising = %d", i);
- DOF2_SetInt(Arquivo,str,PlayerInfo[playerid][mCoins]);
- }
- DOF2_SaveFile();
- return 1;
- }
- stock 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");
- ShowPlayerDialog(playerid, 2318, DIALOG_STYLE_LIST, "Menu Coins",string,"Selecionar", "Sair");
- return 1;
- }
- CMD:creditos(playerid)
- {
- SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}Media_Wallker Pela Criação do Sistema");
- return 1;
- }
- CMD:ajuda(playerid)
- {
- SendClientMessage(playerid, -1, "{00FFFF} » {FFFFFF}/comprar,/creditos,/darcoins");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment