//public OnDialogResponse
new armaid, municoes, arma;
switch(dialogid)
{
case DIALOG_MOCHILA_PEGAR:
{
if(response)
{
arma = armamento[playerid][listitem+1][a_armaid];
municoes = armamento[playerid][listitem+1][a_municoes];
armamento[playerid][listitem+1][a_armaid] = 0;
armamento[playerid][listitem+1][a_municoes] = 0;
format(_string, sizeof(_string), "[ MOCHILA ] Vocк pegou a arma %s com %d de muniзгo", NomeArmas[arma], municoes);
SendClientMessage(playerid, -1, _string);
GivePlayerWeapon(playerid, arma, municoes);
} //cancelar
}
case DIALOG_MOCHILA:
{
if(response)
{
if(listitem == 0) // Guardar Arma
{
if(GetPlayerWeapon(playerid) == 0) return SendClientMessage(playerid, 0xFF0000FF, "Vocк nгo estб com nenhuma arma na mгo!");
for(new y = 1; y < MAX_ARMAS; y++)
{
if(armamento[playerid][y][a_armaid] != 0) continue;
armaid = y;
break;
}
arma = GetPlayerWeapon(playerid), municoes = GetPlayerAmmo(playerid);
armamento[playerid][armaid][a_armaid] = arma;
armamento[playerid][armaid][a_municoes] = municoes;
format(_string, sizeof(_string), "[ MOCHILA ] Vocк guardou a arma %s com %d de muniзгo em sua mochila", NomeArmas[arma], municoes);
SendClientMessage(playerid, -1, _string);
RemovePlayerWeapon(playerid, arma);
}
if(listitem == 1) // Pegar Arma
{
new string[1024],string2[256];
for(new y = 1; y < MAX_ARMAS; y++)
{
if(armamento[playerid][y][a_armaid] > 0)
{
armaid = armamento[playerid][y][a_armaid];
municoes = armamento[playerid][y][a_municoes];
if(y == 1)
{
format(string2, sizeof(string2), "{FFFFFF}Arma\t{FFFFFF}Muniзгo\n0%d. {FF6347}%s\t{D3D3D3}%d\n", y, NomeArmas[armaid], municoes);
strcat(string, string2);
} else {
format(string2, sizeof(string2), "\n0%d. {FF6347}%s\t{D3D3D3}%d", y, NomeArmas[armaid], municoes);
strcat(string, string2);
}
}
}
ShowPlayerDialog(playerid, DIALOG_MOCHILA_PEGAR, DIALOG_STYLE_TABLIST_HEADERS, "MOCHILA", string, "Selecionar", "Cancelar");
}
//
}
}
}
Vocк tentou guarda a arma dnv? eu acho que й ai o problema, vocк nгo seta outra arma no lugar da AK que foi pega a arma que saiu do index 1 nгo entra outra nesse index tente verificar isso, tente colocar a AK de volta e ve se aparece a deagle.
|
for(new y = 0; y < MAX_ARMAS; y++)
AjustarArma(playerid){
for(new i = 0; i < MAX_ARMAS; i++){
if(armamento[playerid][i][a_armaid] != 0){ // se essa arma for diferente de 0 verifica se a anterior й 0
for(new y = 0; y < MAX_ARMAS; y++){
if(armamento[playerid][y][a_armaid] == 0){ // essa й a anterior!
armamento[playerid][y][a_armaid] = armamento[playerid][i][a_armaid];
armamento[playerid][y][a_municoes] = armamento[playerid][i][a_municoes];
// antiga posiзгo recebe 0
armamento[playerid][i][a_armaid] = 0;
armamento[playerid][i][a_municoes] = 0;
}
}
}
}
}
coloca abaixo qnd remove
PHP Code:
|