SA-MP Forums Archive
[Ajuda] Kit de Armas - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Kit de Armas (/showthread.php?tid=361614)



Kit de Armas - Netinho_the_killer - 21.07.2012

Criei este simplecissimo comando de kits de armas, mas queria um codigo para que um player ao setar pela segunda vez outro kit, que ocorra o reset das suas armas anteriores mas nгo as que ele pediu. Pois nao quero acumular nem muniзхes nem armas
Serб que alguem me pode ajudar?

Код HTML:
if (strcmp("/kits", cmdtext, true, 10) == 0)
	{
		SendClientMessage(playerid, 0x990000DD, "----------------------------------------------------------KITS--------------------------------------------------------------");
	 	SendClientMessage(playerid, COLOR_GREEN, "Escolha o Kit que mais o desperta а Atenзгo! E adquira-o digitando o cmd");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Knife--9mm--Shotgun--Micro SMG/Uzi--Country Riffle--Molotov Cocktail == {FF6600}Custo: 500Ј {FF0000}/Kit1");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Knife--Silenced 9mm--Shotgun--Tec-9--Country Riffle--Tear Gas == {FF6600}Custo: 600Ј {FF0000}/Kit2");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Knife--Desert Eagle--Combat Shotgun--Tec-9--Country Riffle--AK-47--Molotov Cocktail == {FF6600}Custo: 850Ј {FF0000}/Kit3");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Combat Shotgun--Tec-9--Sniper Rifle--AK-47--Grenade == {FF6600}Custo: 1000Ј {FF0000}/Kit4");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Combat Shotgun--MP5--Sniper Rifle--M4--Grenade == {FF6600}Custo: 1250Ј {FF0000}/Kit5");
	 	SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Sawnoff Shotgun--MP5--Sniper Rifle--M4--Grenade == {FF6600}Custo: 1500Ј {FF0000}/Kit6");
	 	SendClientMessage(playerid, COLOR_BROWN, "---------------------------------------------------------------------------------------------------------------------------");
   		return 1;
   	}
	if (strcmp(cmdtext, "/kit1", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 1!");
		GivePlayerMoney(playerid, -500);
		GivePlayerWeapon(playerid, 4, 1);
		GivePlayerWeapon(playerid, 22, 1000);
		GivePlayerWeapon(playerid, 25, 1000);
		GivePlayerWeapon(playerid, 28, 1000);
		GivePlayerWeapon(playerid, 33, 1000);
		GivePlayerWeapon(playerid, 18, 10);
		return 1;
	}
	if (strcmp(cmdtext, "/kit2", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 2!");
		GivePlayerMoney(playerid, -600);
		GivePlayerWeapon(playerid, 4, 1);
		GivePlayerWeapon(playerid, 23, 1000);
		GivePlayerWeapon(playerid, 25, 1000);
		GivePlayerWeapon(playerid, 32, 1000);
		GivePlayerWeapon(playerid, 33, 1000);
		GivePlayerWeapon(playerid, 17, 10);
		return 1;
	}
	if (strcmp(cmdtext, "/kit3", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 3!");
		GivePlayerMoney(playerid, -850);
		GivePlayerWeapon(playerid, 4, 1);
		GivePlayerWeapon(playerid, 24, 1000);
		GivePlayerWeapon(playerid, 27, 1000);
		GivePlayerWeapon(playerid, 32, 1000);
		GivePlayerWeapon(playerid, 33, 1000);
		GivePlayerWeapon(playerid, 30, 1000);
		GivePlayerWeapon(playerid, 18, 10);
		return 1;
	}
	if (strcmp(cmdtext, "/kit4", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 4!");
		GivePlayerMoney(playerid, -1000);
		GivePlayerWeapon(playerid, 9, 1);
		GivePlayerWeapon(playerid, 24, 1000);
		GivePlayerWeapon(playerid, 27, 1000);
		GivePlayerWeapon(playerid, 32, 1000);
		GivePlayerWeapon(playerid, 34, 1000);
		GivePlayerWeapon(playerid, 30, 1000);
		GivePlayerWeapon(playerid, 16, 10);
		return 1;
	}
	if (strcmp(cmdtext, "/kit5", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 5!");
		GivePlayerMoney(playerid, -1250);
		GivePlayerWeapon(playerid, 9, 1);
		GivePlayerWeapon(playerid, 24, 1000);
		GivePlayerWeapon(playerid, 27, 1000);
		GivePlayerWeapon(playerid, 29, 1000);
		GivePlayerWeapon(playerid, 34, 1000);
		GivePlayerWeapon(playerid, 31, 1000);
		GivePlayerWeapon(playerid, 16, 10);
		return 1;
	}
	if (strcmp(cmdtext, "/kit6", true) ==0)
    {
		SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 6!");
		GivePlayerMoney(playerid, -1500);
		GivePlayerWeapon(playerid, 9, 1);
		GivePlayerWeapon(playerid, 24, 1000);
		GivePlayerWeapon(playerid, 26, 1000);
		GivePlayerWeapon(playerid, 29, 1000);
		GivePlayerWeapon(playerid, 34, 1000);
		GivePlayerWeapon(playerid, 31, 1000);
		GivePlayerWeapon(playerid, 16, 10);
		return 1;
	}



Re: Kit de Armas - Math3us - 21.07.2012

coloca ResetPlayerWeapons(playerid); em todas no comeзo


Re: Kit de Armas - Netinho_the_killer - 21.07.2012

Tem razгo amigo eu tinha posto isso no final e pensei que no incio e no final era a mesma coisa, mas escapou-me esta coisa tгo basica. Obrigadгo por me relembrar que os comandos sao exectudos por ordemm


Re: Kit de Armas - @Riichard - 21.07.2012

Quote:
Originally Posted by Netinho_the_killer
Посмотреть сообщение
amigo agradeзo o esforзo mas isso й algo que eu tambem ja pus. E o problema й que reseta o kit antigo e o novo
Se saber por funciona:
pawn Код:
if (strcmp("/kits", cmdtext, true, 10) == 0)
       {
            SendClientMessage(playerid, 0x990000DD, "----------------------------------------------------------KITS--------------------------------------------------------------");
            SendClientMessage(playerid, COLOR_GREEN, "Escolha o Kit que mais o desperta а Atenзгo! E adquira-o digitando o cmd");
            SendClientMessage(playerid, COLOR_YELLOW, "Knife--9mm--Shotgun--Micro SMG/Uzi--Country Riffle--Molotov Cocktail == {FF6600}Custo: 500Ј {FF0000}/Kit1");
            SendClientMessage(playerid, COLOR_YELLOW, "Knife--Silenced 9mm--Shotgun--Tec-9--Country Riffle--Tear Gas == {FF6600}Custo: 600Ј {FF0000}/Kit2");
            SendClientMessage(playerid, COLOR_YELLOW, "Knife--Desert Eagle--Combat Shotgun--Tec-9--Country Riffle--AK-47--Molotov Cocktail == {FF6600}Custo: 850Ј {FF0000}/Kit3");
            SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Combat Shotgun--Tec-9--Sniper Rifle--AK-47--Grenade == {FF6600}Custo: 1000Ј {FF0000}/Kit4");
            SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Combat Shotgun--MP5--Sniper Rifle--M4--Grenade == {FF6600}Custo: 1250Ј {FF0000}/Kit5");
            SendClientMessage(playerid, COLOR_YELLOW, "Chainsaw--Desert Eagle--Sawnoff Shotgun--MP5--Sniper Rifle--M4--Grenade == {FF6600}Custo: 1500Ј {FF0000}/Kit6");
            SendClientMessage(playerid, COLOR_BROWN, "---------------------------------------------------------------------------------------------------------------------------");
            return 1;
       }
       if (strcmp(cmdtext, "/kit1", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 1!");
            GivePlayerMoney(playerid, -500);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 22, 1000);
            GivePlayerWeapon(playerid, 25, 1000);
            GivePlayerWeapon(playerid, 28, 1000);
            GivePlayerWeapon(playerid, 33, 1000);
            GivePlayerWeapon(playerid, 18, 10);
            return 1;
       }
       if (strcmp(cmdtext, "/kit2", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 2!");
            GivePlayerMoney(playerid, -600);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 23, 1000);
            GivePlayerWeapon(playerid, 25, 1000);
            GivePlayerWeapon(playerid, 32, 1000);
            GivePlayerWeapon(playerid, 33, 1000);
            GivePlayerWeapon(playerid, 17, 10);
            return 1;
       }
       if (strcmp(cmdtext, "/kit3", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 3!");
            GivePlayerMoney(playerid, -850);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 4, 1);
            GivePlayerWeapon(playerid, 24, 1000);
            GivePlayerWeapon(playerid, 27, 1000);
            GivePlayerWeapon(playerid, 32, 1000);
            GivePlayerWeapon(playerid, 33, 1000);
            GivePlayerWeapon(playerid, 30, 1000);
            GivePlayerWeapon(playerid, 18, 10);
            return 1;
       }
       if (strcmp(cmdtext, "/kit4", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 4!");
            GivePlayerMoney(playerid, -1000);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 9, 1);
            GivePlayerWeapon(playerid, 24, 1000);
            GivePlayerWeapon(playerid, 27, 1000);
            GivePlayerWeapon(playerid, 32, 1000);
            GivePlayerWeapon(playerid, 34, 1000);
            GivePlayerWeapon(playerid, 30, 1000);
            GivePlayerWeapon(playerid, 16, 10);
            return 1;
       }
       if (strcmp(cmdtext, "/kit5", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 5!");
            GivePlayerMoney(playerid, -1250);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 9, 1);
            GivePlayerWeapon(playerid, 24, 1000);
            GivePlayerWeapon(playerid, 27, 1000);
            GivePlayerWeapon(playerid, 29, 1000);
            GivePlayerWeapon(playerid, 34, 1000);
            GivePlayerWeapon(playerid, 31, 1000);
            GivePlayerWeapon(playerid, 16, 10);
            return 1;
       }
       if (strcmp(cmdtext, "/kit6", true) ==0)
       {
            SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 6!");
            GivePlayerMoney(playerid, -1500);
            ResetPlayerWeapons(playerid);
            GivePlayerWeapon(playerid, 9, 1);
            GivePlayerWeapon(playerid, 24, 1000);
            GivePlayerWeapon(playerid, 26, 1000);
            GivePlayerWeapon(playerid, 29, 1000);
            GivePlayerWeapon(playerid, 34, 1000);
            GivePlayerWeapon(playerid, 31, 1000);
            GivePlayerWeapon(playerid, 16, 10);
            return 1;
       }



Re: Kit de Armas - jilead - 21.07.2012

ponha no inicio ResetPlayerWeapons(playerid);

exemplo
Quote:

if (strcmp(cmdtext, "/kit1", true) ==0)
{
ResetPlayerWeapons(playerid); //ponha ak ou antes de qualquer GivePlayerWeapon
SendClientMessage(playerid, 0x33AA33AA, "Escolheu o Kit de armas 1!");
GivePlayerMoney(playerid, -500);
GivePlayerWeapon(playerid, 4, 1);
GivePlayerWeapon(playerid, 22, 1000);
GivePlayerWeapon(playerid, 25, 1000);
GivePlayerWeapon(playerid, 28, 1000);
GivePlayerWeapon(playerid, 33, 1000);
GivePlayerWeapon(playerid, 18, 10);
return 1;
}




Re: Kit de Armas - Netinho_the_killer - 21.07.2012

Jб esta resolvido como disse acima ja tinha posto em baixo e esqueci-me de que os comandos eram executados por ordem, obrigado por me lembrarem de uma coisa tao basica