[Ajuda] Kit de Armas
#1

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;
	}
Reply
#2

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

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
Reply
#4

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;
       }
Reply
#5

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;
}

Reply
#6

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
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)