Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * kWeapons v1.0.1 - Criado e idealizado por Kusty!
- * Com códigos obtidos atraves do Fórum SA-MP e da Wiki SA-MP.
- * Não retire os créditos.
- */
- #include <a_samp>
- #include <zcmd>
- // ~~~~~~~~~~~~~ Dialogs ~~~~~~~~~~~~~
- #define ChoiceOfWeapons 1420
- #define AmountOfAmmunition 1421
- #define AmountOfHealth 1422
- #define AmountOfArmour 1423
- #define ArmasBrancas 1424
- #define Pistolas 1425
- #define Escopetas 1426
- #define SubMetralhadoras 1427
- #define FuzisDeAssalto 1428
- #define Rifles 1429
- #define Explosivos 1430
- #define Presentes 1431
- #define Outros 1432
- #define VidaEColete 1433
- #define PriceOfAmmo (50) // Defina aqui o preço de uma munição.
- #define PriceOfHealthAndArmour (10) // Defina aqui o preço de uma porcentagem de vida e colete.
- new HealthOrArmour[MAX_PLAYERS]; // Definimos se é vida ou colete.
- new IDOfWeapon[MAX_PLAYERS]; // Armazenamos o ID das armas. Idealização por: histire.
- // ~~~~~~~~~~~~~ Public's ~~~~~~~~~~~~~
- public OnFilterScriptInit()
- {
- print("\n============== [ kWeapons ] ================");
- print(" Sistema de armas carregado com sucesso! ");
- print("============================================\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- print("\n============== [ kWeapons ] ================");
- print(" Sistema de armas descarregado com sucesso! ");
- print("============================================\n");
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- // ~~~~~~~~~~~~~ Dialog de escolha da categoria ~~~~~~~~~~~~~
- switch(dialogid) {
- case ChoiceOfWeapons: {
- if(response) {
- switch(listitem) {
- case 0: ShowPlayerDialog(playerid, ArmasBrancas, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Armas brancas:", "Soco Inglês\nTaco de Baseball\nSerra Elétrica\nTaco de Golf\nKatana\nFaca\nCacetete\nTaco de Brilhar\nPá", "Selecionar", "Cancelar");
- case 1: ShowPlayerDialog(playerid, Pistolas, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Pistolas:", "9mm\n9mm com silenciador\nDesert Eagle", "Selecionar", "Cancelar");
- case 2: ShowPlayerDialog(playerid, Escopetas, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Escopetas:", "Escopeta\nEscopeta de cano cerrado\nSPAS 12", "Selecionar", "Cancelar");
- case 3: ShowPlayerDialog(playerid, SubMetralhadoras, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Sub-Metralhadoras", "Micro Uzi\nSMG\nTec-9", "Selecionar", "Cancelar");
- case 4: ShowPlayerDialog(playerid, FuzisDeAssalto, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Fuzis de Assalto:", "AK-47\nM4", "Selecionar", "Cancelar");
- case 5: ShowPlayerDialog(playerid, Rifles, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Rifles", "Rifle\nRifle de francoatirador", "Selecionar", "Cancelar");
- case 6: ShowPlayerDialog(playerid, Explosivos, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Explosivos:", "Granada\nCarga Explosiva\nGranada de Gás", "Selecionar", "Cancelar");
- case 7: ShowPlayerDialog(playerid, Presentes, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Presentes:", "Bengala\nFlores\nVibrador\nVibrador 2\nVibrador Duplo\nVibrador Prata", "Selecionar", "Cancelar");
- case 8: ShowPlayerDialog(playerid, Outros, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Outros:", "Câmera\nExtintor\nSpray de graffiti\nParaquedas", "Selecionar", "Cancelar");
- case 9: ShowPlayerDialog(playerid, VidaEColete, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Vida e colete:", "Vida\nColete", "Selecionar", "Cancelar");
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog de armas brancas ~~~~~~~~~~~~~
- switch(dialogid) {
- case ArmasBrancas: {
- if(response) {
- switch(listitem) {
- case 0: {
- GivePlayerWeapon(playerid, 1, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Soco Inglês por: $100!");
- GivePlayerMoney(playerid, -100); }
- case 1: {
- GivePlayerWeapon(playerid, 5, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Taco de Baseball por: $100!");
- GivePlayerMoney(playerid, -100); }
- case 2: {
- GivePlayerWeapon(playerid, 9, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma Serra Elétrica por: $500!");
- GivePlayerMoney(playerid, -500); }
- case 3: {
- GivePlayerWeapon(playerid, 2, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Taco de Gold por: $100!");
- GivePlayerMoney(playerid, -100); }
- case 4: {
- GivePlayerWeapon(playerid, 8, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma Katana por: $100!");
- GivePlayerMoney(playerid, -100); }
- case 5: {
- GivePlayerWeapon(playerid, 4, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma Faca por: $50!");
- GivePlayerMoney(playerid, -50); }
- case 6: {
- GivePlayerWeapon(playerid, 3, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Cacete por: $100!");
- GivePlayerMoney(playerid, -100); }
- case 7: {
- GivePlayerWeapon(playerid, 9, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Taco de Brilhar(Taco de Snooker/Sinuca) por: $30!");
- GivePlayerMoney(playerid, -30); }
- case 8: {
- GivePlayerWeapon(playerid, 9, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma Pá por: $20!");
- GivePlayerMoney(playerid, -20); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog das pistolas ~~~~~~~~~~~~~
- switch(dialogid) {
- case Pistolas: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 22;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 23;
- AmountsOfAmmunition(playerid); }
- case 2: {
- IDOfWeapon[playerid] = 24;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog das Escopetas ~~~~~~~~~~~~~
- switch(dialogid) {
- case Escopetas: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 25;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 26;
- AmountsOfAmmunition(playerid); }
- case 2: {
- IDOfWeapon[playerid] = 27;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog das SubMetralhadoras ~~~~~~~~~~~~~
- switch(dialogid) {
- case SubMetralhadoras: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 28;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 29;
- AmountsOfAmmunition(playerid); }
- case 2: {
- IDOfWeapon[playerid] = 32;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog do Fuzis de Assalto ~~~~~~~~~~~~~
- switch(dialogid) {
- case FuzisDeAssalto: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 30;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 31;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog dos Rifles ~~~~~~~~~~~~~
- switch(dialogid) {
- case Rifles: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 33;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 34;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog dos Explosivos ~~~~~~~~~~~~~
- switch(dialogid) {
- case Explosivos: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 16;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 39;
- AmountsOfAmmunition(playerid); }
- case 2: {
- IDOfWeapon[playerid] = 17;
- AmountsOfAmmunition(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog dos Presentes~~~~~~~~~~~~~
- switch(dialogid) {
- case Presentes: {
- if(response) {
- switch(listitem) {
- case 0: {
- GivePlayerWeapon(playerid, 15, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma Bengala por: $50!");
- GivePlayerMoney(playerid, -50); }
- case 1: {
- GivePlayerWeapon(playerid, 14, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Buquer de Flor por: $20!");
- GivePlayerMoney(playerid, -20); }
- case 2: {
- GivePlayerWeapon(playerid, 12, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Vibrador por: $150!");
- GivePlayerMoney(playerid, -150); }
- case 3: {
- IDOfWeapon[playerid] = 11;
- GivePlayerWeapon(playerid, 11, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Vibrador por: $150!");
- GivePlayerMoney(playerid, -150); }
- case 4: {
- IDOfWeapon[playerid] = 10;
- GivePlayerWeapon(playerid, 4, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Vibrador por: $200!");
- GivePlayerMoney(playerid, -200); }
- case 5: {
- GivePlayerWeapon(playerid, 13, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um Vibrador Prata por: $250!");
- GivePlayerMoney(playerid, -250); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog de Outras Armas/Utilitarios ~~~~~~~~~~~~~
- switch(dialogid) {
- case Outros: {
- if(response) {
- switch(listitem) {
- case 0: {
- IDOfWeapon[playerid] = 43;
- AmountsOfAmmunition(playerid); }
- case 1: {
- IDOfWeapon[playerid] = 42;
- AmountsOfAmmunition(playerid); }
- case 2: {
- IDOfWeapon[playerid] = 41;
- AmountsOfAmmunition(playerid); }
- case 3: {
- GivePlayerWeapon(playerid, 46, 1);
- SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você comprou um paraquedas por: $500!");
- GivePlayerMoney(playerid, -500); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog de vida e colete ~~~~~~~~~~~~~
- switch(dialogid) {
- case VidaEColete: {
- if(response) {
- switch(listitem) {
- case 0: {
- HealthOrArmour[playerid] = 1;
- AmountsOfHealthAndArmour(playerid); }
- case 1: {
- HealthOrArmour[playerid] = 2;
- AmountsOfHealthAndArmour(playerid); }
- }
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog da porcentagem de vida ~~~~~~~~~~~~~
- switch(dialogid) {
- case AmountOfHealth: {
- if(response) {
- new
- Float:Health,
- FinalPrice = strval(inputtext)*PriceOfHealthAndArmour,
- string[129];
- if(100-Health > strval(inputtext)) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Sua vida está cheia ou não há espaço para essa porcentagem de vida!");
- if(GetPlayerMoney(playerid) < FinalPrice) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você não tem dinheiro para comprar essa porcentagem de vida!");
- if(!IsNumeric(inputtext)) return AmountsOfHealthAndArmour(playerid);
- if(strval(inputtext) > 100) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} A porcentagem deverá ser entre 1 e 100!");
- GetPlayerHealth(playerid, Health);
- SetPlayerHealth(playerid, Health+strval(inputtext));
- GivePlayerMoney(playerid, -FinalPrice);
- format(string, sizeof(string), "{FF0000}[kWeapons]:{FFFFFF} Você encheu a sua vida com %i % por $%i!", strval(inputtext), FinalPrice);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog da porcentagem de colete ~~~~~~~~~~~~~
- switch(dialogid) {
- case AmountOfArmour: {
- if(response) {
- new
- Float:Armour,
- FinalPrice = strval(inputtext)*PriceOfHealthAndArmour,
- string[129];
- if(100-Armour > strval(inputtext)) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Seu colete está cheio ou não há espaço para essa porcentagem de colete!");
- if(GetPlayerMoney(playerid) < FinalPrice) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você não tem dinheiro para comprar essa porcentagem de colete!");
- if(!IsNumeric(inputtext)) return AmountsOfHealthAndArmour(playerid);
- if(strval(inputtext) > 100) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} A porcentagem deverá ser entre 1 e 100!");
- GetPlayerArmour(playerid, Armour);
- SetPlayerArmour(playerid, Armour+strval(inputtext));
- GivePlayerMoney(playerid, -FinalPrice);
- format(string, sizeof(string), "{FF0000}[kWeapons]:{FFFFFF} Você encheu o seu colete com %i % por $%i!", strval(inputtext), FinalPrice);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- }
- }
- // ~~~~~~~~~~~~~ Dialog da quantia de munição ~~~~~~~~~~~~~
- switch(dialogid) {
- case AmountOfAmmunition: {
- if(response) {
- new
- FinalPrice = strval(inputtext)*PriceOfAmmo,
- string[129];
- if(GetPlayerMoney(playerid) < FinalPrice) return SendClientMessage(playerid, -1, "{FF0000}[kWeapons]:{FFFFFF} Você não tem dinheiro para comprar essa quantia de munição!");
- if(!IsNumeric(inputtext)) return AmountsOfAmmunition(playerid);
- GivePlayerWeapon(playerid, IDOfWeapon[playerid], strval(inputtext));
- GivePlayerMoney(playerid, -FinalPrice);
- format(string, sizeof(string), "{FF0000}[kWeapons]:{FFFFFF} Você comprou uma arma com %i munições por $%i!", strval(inputtext), FinalPrice);
- SendClientMessage(playerid, -1, string);
- return 1;
- }
- }
- }
- return 0;
- }
- // ~~~~~~~~~~~~~ Criamos nosso comando ~~~~~~~~~~~~~
- CMD:armas(playerid) {
- ShowPlayerDialog(playerid, ChoiceOfWeapons, DIALOG_STYLE_LIST, "{FF0000}[kWeapons]:{FFFFFF} Escolha a categoria de armas:", "Armas brancas\nPistolas\nEscopetas\nSub-Metralhadoras\nFuzis de Assalto\nRifles\nExplosivos\nPresentes\nOutros\nVida e Colete", "Selecionar", "Cancelar");
- return 1; }
- // ~~~~~~~~~~~~~ Dialog da quantia de munição ~~~~~~~~~~~~~
- stock AmountsOfAmmunition(playerid) {
- new string[129];
- format(string, sizeof(string), "Insira a quantidade de munições que você deseja.\nCada munição está custando: {FF0000}$%i\n\nUtilize somente números*", PriceOfAmmo);
- ShowPlayerDialog(playerid, AmountOfAmmunition, DIALOG_STYLE_INPUT, "{FF0000}[kWeapons]:{FFFFFF} Quantidade de munições:", string, "Comprar", "Cancelar");
- return 1;
- }
- // ~~~~~~~~~~~~~ Dialog da porcentagem de vida e colete ~~~~~~~~~~~~~
- stock AmountsOfHealthAndArmour(playerid) {
- new string[129];
- switch(HealthOrArmour[playerid]) {
- case 1: {
- format(string, sizeof(string), "Insira a porcentagem de vida que você deseja.\nCada porcentagem está custando: {FF0000}$%i\n\nUtilize somente números*", PriceOfHealthAndArmour);
- ShowPlayerDialog(playerid, AmountOfHealth, DIALOG_STYLE_INPUT, "{FF0000}[kWeapons]:{FFFFFF} Porcentagem de vida:", string, "Comprar", "Cancelar"); }
- case 2: {
- format(string, sizeof(string), "Insira a porcentagem de colete que você deseja.\nCada porcentagem está custando: {FF0000}$%i\n\nUtilize somente números*", PriceOfHealthAndArmour);
- ShowPlayerDialog(playerid, AmountOfArmour, DIALOG_STYLE_INPUT, "{FF0000}[kWeapons]:{FFFFFF} Porcentagem de colete:", string, "Comprar", "Cancelar"); }
- }
- return 1;
- }
- // ~~~~~~~~~~~~~ Verificamos se é número ~~~~~~~~~~~~~
- stock IsNumeric(const string[]) {
- for (new i = 0, j = strlen(string); i < j; i++)
- {
- if (string[i] > '9' || string[i] < '0') return 0;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement