SA-MP Forums Archive
[Ajuda] Comando bugado - 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] Comando bugado (/showthread.php?tid=609475)



Comando bugado - Derritee1001 - 13.06.2016

E aн galera, esse comando aqui estб com um bugzinho. Quando o motorista guarda a arma, a muniзгo dela fica como 0, jб se o passageiro guarda a arma, a muniзгo dela fica correta, de acordo com as muniзхes da arma.
Ficarei muito grato de vocкs poderem me ajudar.

Comando:
Code:
CMD:gunrack(playerid, params[])
{
	new i = GetPlayerVehicleID(playerid);
	new gunname[256], string[256];

	if (GetFactionType(playerid) != FACTION_POLICE)
	return SendErrorMessage(playerid, "Vocк deve ser um oficial de polнcia.");

	if (!IsACruiser(GetPlayerVehicleID(playerid)))
	return SendErrorMessage(playerid, "Vocк deve estar dentro de uma viatura.");

	if(Gunrack[i][Weapon1] != 0)
	{

		GetWeaponName(Gunrack[i][Weapon1], gunname, sizeof(gunname));
		format(string, sizeof(string), "Arma: %s (%d balas)\n", gunname, Gunrack[i][Ammo1]);
	}
	else
	if(Gunrack[i][Weapon1] == 0)
	{

		format(string, sizeof(string), "Slot Vazio\n");
	}
	Dialog_Show(playerid, Gunrack, DIALOG_STYLE_LIST, "Gunrack", string, "Selecionar", "Cancelar");
	return 1;
}
Dialog:
Code:
Dialog:Gunrack(playerid, response, listitem, inputtext[])
{
    if(response)
    {



        new vehicleid = GetPlayerVehicleID(playerid);

        switch(listitem)
        {



            case 0:
            {



                if(Gunrack[vehicleid][Weapon1] == 0)
                {



                    new gunid = GetPlayerWeapon(playerid);
                    new ammo = GetPlayerAmmo(playerid);

                    if(gunid == 0) return SendClientMessage(playerid, COLOR_WHITE, "[INFO]: Escolha sua arma que deseja colocar no gunrack.");
                    Gunrack[vehicleid][Weapon1] = gunid;
                    Gunrack[vehicleid][Ammo1] = ammo;
                    RemovePlayerWeapon(playerid, gunid);
                    SendClientMessage(playerid,COLOR_WHITE, "[SERVIDOR]: Vocк colocou sua arma no gunrack.");
                }
                else
                {



                    GiveWeaponToPlayer(playerid, Gunrack[vehicleid][Weapon1], Gunrack[vehicleid][Ammo1]);
                    Gunrack[vehicleid][Weapon1] = 0;
                    SendClientMessage(playerid,COLOR_WHITE, "[SERVIDOR]: Vocк pegou sua arma no gunrack.");
                }
            }
        }
    }
    return 0;
}