Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Filterscript desenvolvido por Fábio Stralioti
- #include <a_samp>
- #include <zcmd>
- #include <sscanf>
- #include <dof2>
- #define DIALOG_CASH 1
- #define DIALOG_MENU 2
- #define DIALOG_LOJA 3
- #define DIALOG_ARMAS 4
- #define DIALOG_CARROS 5
- #define DIALOG_TESTE 6
- #define COR_VERMELHO 0xFF0000FF
- #define MAX_ARMAS 5
- #define MAX_CARROS 4
- enum pInfo
- {
- Cash,
- Arma,
- Veiculo
- }
- new Player[MAX_PLAYERS][pInfo];
- new Float:X, Float:Y, Float:Z, Float: Angle;
- new Text:TextCash;
- enum veiculos
- {
- nomev[20],
- idv,
- valorv
- }
- new veiculo[MAX_CARROS][veiculos] =
- {
- {"Sultan", 560, 150},
- {"Infernus", 411, 200},
- {"NRG-500", 522, 250},
- {"Super-GT", 506, 300}
- };
- enum armas
- {
- nomea[20],
- ida,
- muna,
- valora
- }
- new arma[MAX_ARMAS][armas] =
- {
- {"Shotgun", 25, 999, 25},
- {"MP5", 29, 999, 50},
- {"M4-A1", 31, 999, 100},
- {"AK-47", 30, 999, 200},
- {"Sniper", 34, 999, 300}
- };
- #if defined FILTERSCRIPT
- #define FILTERSCRIPT
- #endif
- public OnFilterScriptInit()
- {
- print("Filterscript feito por: Fábio Stralioti");
- print("Sistema de cash iniciado!");
- SetTimer("atualizacash", 1000, true);
- TextCash = TextDrawCreate(548.000000, 82.000000, "");
- TextDrawBackgroundColor(TextCash, 255);
- TextDrawFont(TextCash, 2);
- TextDrawLetterSize(TextCash, 0.320000, 1.500000);
- TextDrawColor(TextCash, -16776961);
- TextDrawSetOutline(TextCash, 0);
- TextDrawSetProportional(TextCash, 1);
- TextDrawSetShadow(TextCash, 2);
- TextDrawSetSelectable(TextCash, 0);
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_MENU)
- {
- if(response)
- {
- if(listitem == 0)
- {
- }
- if(listitem == 1)
- {
- ShowPlayerDialog(playerid, DIALOG_LOJA, DIALOG_STYLE_LIST, "LOJA", "Armas\nCarros", "Escolher", "Sair");
- }
- if(listitem == 2)
- {
- }
- }
- }
- if(dialogid == DIALOG_LOJA)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new string[128];
- for(new i = 0; i < MAX_ARMAS; i ++)
- {
- format(string, sizeof(string),"%s%s {ff0000}%d\n", string, arma[i][nomea], arma[i][valora]);
- }
- ShowPlayerDialog(playerid, DIALOG_ARMAS, DIALOG_STYLE_LIST, "ARMAS", string, "Escolher", "Sair");
- }
- if(listitem == 1)
- {
- new string[128];
- for(new i = 0; i < MAX_CARROS; i ++)
- {
- format(string, sizeof(string),"%s%s {ff0000}%d\n", string, veiculo[i][nomev], veiculo[i][valorv]);
- }
- ShowPlayerDialog(playerid, DIALOG_CARROS, DIALOG_STYLE_LIST, "CARROS", string, "Escolher", "Sair");
- }
- }
- }
- if(dialogid == DIALOG_ARMAS)
- {
- if(response)
- {
- new each = -1;
- for(new i = 0; i < MAX_ARMAS; i ++)
- {
- each += 1;
- if(each == listitem)
- {
- if(Player[playerid][Cash] < arma[i][valora])
- {
- SendClientMessage(playerid, COR_VERMELHO,"Você não tem essa quantidade de cash");
- return 1;
- }
- new string[50];
- format(string, sizeof(string), "Você comprou uma %s", arma[i][nomea]);
- SendClientMessage(playerid, -1, string);
- Player[playerid][Arma] = GivePlayerWeapon(playerid, arma[i][ida], arma[i][muna]);
- Player[playerid][Cash] -= arma[i][valora];
- }
- }
- }
- }
- if(dialogid == DIALOG_CARROS)
- {
- if(response)
- {
- new each = -1;
- for(new i = 0; i < MAX_CARROS; i ++)
- {
- each += 1;
- if(each == listitem)
- {
- if(Player[playerid][Cash] < veiculo[i][valorv])
- {
- SendClientMessage(playerid, COR_VERMELHO,"Você não tem essa quantidade de cash");
- return 1;
- }
- new string[50];
- format(string, sizeof(string), "Você comprou um %s", veiculo[i][nomev]);
- SendClientMessage(playerid, -1, string);
- GetPlayerPos(playerid, X, Y, Z);
- GetPlayerFacingAngle(playerid, Angle);
- Player[playerid][Veiculo] = CreateVehicle(veiculo[i][idv], X+5, Y, Z+1, Angle, random(100), random(100), -1);
- Player[playerid][Cash] -= veiculo[i][valorv];
- }
- }
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new string[128];
- format(string, sizeof(string), "Cash/%s.ini", PlayerNome(playerid));
- if(!DOF2_FileExists(string)) DOF2_CreateFile(string);
- Carregar(playerid);
- SendClientMessage(playerid, -1,"Esse servidor utiliza o FilterScript de Cash");
- SendClientMessage(playerid, -1,"Use /comandosfs e veja todos os comandos do FS");
- TextDrawShowForPlayer(playerid, TextCash);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- TextDrawHideForPlayer(playerid, TextCash);
- Salvar(playerid);
- return 1;
- }
- public OnFilterScriptExit()
- {
- DOF2_Exit();
- return 1;
- }
- CMD:cash(playerid, params[])
- {
- new string[120];
- format(string, sizeof(string), "Cash disponível: {ff0000}%d\nLoja\nSair", Player[playerid][Cash]);
- ShowPlayerDialog(playerid, DIALOG_MENU, DIALOG_STYLE_LIST, "LOJA DE CASH", string, "Escolher", "Sair");
- return 1;
- }
- CMD:setcash(playerid, params[])
- {
- new id, qntd, string[50], string2[50];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COR_VERMELHO,"Você não é administador");
- if(sscanf(params, "ud", id, qntd)) return SendClientMessage(playerid, COR_VERMELHO,"Use: /setcash [id] [qntd]");
- if(!IsPlayerConnected(id)) return SendClientMessage(playerid, COR_VERMELHO,"Jogador não conectado");
- format(string, sizeof(string),"Você enviou %d de Cash para o %s", qntd, PlayerNome(id));
- SendClientMessage(playerid, -1, string);
- format(string2, sizeof(string2),"Você recebeu %d de Cash do Administrador %s", qntd, PlayerNome(playerid));
- SendClientMessage(id, -1, string2);
- Player[id][Cash] += qntd;
- return 1;
- }
- CMD:creditosfs(playerid)
- {
- SendClientMessage(playerid, -1,"Criado por: Fábio Stralioti");
- return 1;
- }
- CMD:comandosfs(playerid)
- {
- SendClientMessage(playerid, -1,"/cash, /setcash(administrador), /comandosfs, /creditosfs");
- return 1;
- }
- Salvar(playerid)
- {
- new string[128];
- format(string, sizeof(string), "Cash/%s.ini", PlayerNome(playerid));
- if(DOF2_FileExists(string))
- {
- DOF2_SetInt(string,"Cash", Player[playerid][Cash]);
- DOF2_SetInt(string,"Veiculo", veiculo[playerid][idv]);
- new armasv[13][2], each[50];
- for (new i = 0; i <= 12; i++) {
- GetPlayerWeaponData(playerid, i, armasv[i][0], armasv[i][1]);
- format(each, sizeof(each), "Arma%d", i);
- DOF2_SetInt(string, each, armasv[i][0]);
- format(each, sizeof(each), "Municao%d", i);
- DOF2_SetInt(string, each, armasv[i][1]);
- }
- DOF2_SaveFile();
- }
- return 1;
- }
- Carregar(playerid)
- {
- new string[128];
- format(string, sizeof(string), "Cash/%s.ini", PlayerNome(playerid));
- Player[playerid][Cash] = DOF2_GetInt(string, "Cash");
- veiculo[playerid][idv] = DOF2_GetInt(string, "Veiculo");
- new each[50], eacht[50];
- for (new i = 0; i <= 12; i++) {
- format(each, sizeof(each), "Arma%d", i), format(eacht, sizeof(eacht), "Municao%d", i);
- GivePlayerWeapon(playerid, DOF2_GetInt(string, eacht), DOF2_GetInt(PlayerNome(playerid), eacht));
- }
- DOF2_SaveFile();
- return 1;
- }
- PlayerNome(playerid)
- {
- new nomeplayer[MAX_PLAYER_NAME];
- GetPlayerName(playerid, nomeplayer, sizeof(nomeplayer));
- return nomeplayer;
- }
- forward atualizacash(playerid);
- public atualizacash(playerid)
- {
- new string[128];
- format(string,sizeof(string),"C$%d",Player[playerid][Cash]);
- TextDrawSetString(TextCash, string);
- }
Add Comment
Please, Sign In to add comment