CMD:guardai(playerid, response, listitem, params[]) { SelectTextDraw(playerid, 0xAAAAAAFF); if(response){ new weap, ammo; new string[128]; GetPlayerWeaponData(playerid, listitem + 1, weap, ammo); if(ammo < 1) return CancelSelectTextDraw(playerid), SendClientMessage(playerid, COLOR_YELLOW, "*Esta arma й invбlida!"), dialogArmas(playerid); ArmasGuardadas[playerid][Selected[playerid][2]] = weap; BalasGuardadas[playerid][Selected[playerid][2]] = ammo; format(string, sizeof string, "Vocк guardou uma arma %s com %d balas no slot: %d. Para pegar use: /mochila", NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]]),BalasGuardadas[playerid][Selected[playerid][2]], Selected[playerid][2]); SendClientMessage(playerid, COLOR_R, string); RemovePlayerWeapon(playerid, weap); format(string, sizeof(string), "* %s guardou um(a) %s em sua mochila", NomePlayer(playerid), NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]])); SendClientMessageInRange(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "guardando", 0); HideMochila(playerid); } else{ SetPVarInt(playerid, "guardando", 0); } }
dialogArmas(playerid){ if(!countWeapons(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*Vocк nгo tem uma arma com vocк."), CancelSelectTextDraw(playerid),SelectTextDraw(playerid, 0xAAAAAAFF); new Str[95], weap, ammo; MEGAString[0] = EOS; for(new x = 1; x != 13; x++){ GetPlayerWeaponData(playerid, x, weap, ammo); if(weap && ammo){ format(Str, 95, "{FFFFFF}Arma: {A0A0A0}%s {FFFFFF}Balas: {A0A0A0}%03d\n", GunNames[weap], ammo); strcat(MEGAString, Str); }else{ strcat(MEGAString, "{FFFFFF}Arma: {A0A0A0}-------- {FFFFFF}Balas: {A0A0A0}---\n"); } } ShowPlayerDialog(playerid, 306, DIALOG_STYLE_LIST, "Escolha a arma para guardar", MEGAString, "Guardar", "Sair"); return 1; } dialogArmasPM(playerid){ if(!countWeapons(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*Vocк nгo tem uma arma com vocк."), SelectTextDraw(playerid, 0xAAAAAAFF); new Str[95], weap, ammo; MEGAString[0] = EOS; for(new x = 1; x != 13; x++){ GetPlayerWeaponData(playerid, x, weap, ammo); if(weap && ammo){ format(Str, 95, "{FFFFFF}Arma: {A0A0A0}%s {FFFFFF}Balas: {A0A0A0}%03d\n", GunNames[weap], ammo); strcat(MEGAString, Str); }else{ strcat(MEGAString, "{FFFFFF}Arma: {A0A0A0}-------- {FFFFFF}Balas: {A0A0A0}---\n"); } } ShowPlayerDialog(playerid, 308, DIALOG_STYLE_LIST, "Escolha a arma para guardar", MEGAString, "Guardar", "Sair"); return 1; }
if(dialogid == 306){ SelectTextDraw(playerid, 0xAAAAAAFF); if(response){ new weap, ammo; GetPlayerWeaponData(playerid, listitem + 1, weap, ammo); if(ammo < 1) return CancelSelectTextDraw(playerid), SendClientMessage(playerid, COLOR_YELLOW, "*Esta arma й invбlida!"), dialogArmas(playerid); ArmasGuardadas[playerid][Selected[playerid][2]] = weap; BalasGuardadas[playerid][Selected[playerid][2]] = ammo; format(string, sizeof string, "Vocк guardou uma arma %s com %d balas no slot: %d. Para pegar use: /mochila", NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]]),BalasGuardadas[playerid][Selected[playerid][2]], Selected[playerid][2]); SendClientMessage(playerid, COLOR_R, string); RemovePlayerWeapon(playerid, weap); format(string, sizeof(string), "* %s guardou um(a) %s em sua mochila", NomePlayer(playerid), NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]])); SendClientMessageInRange(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "guardando", 0); HideMochila(playerid); } else{ SetPVarInt(playerid, "guardando", 0); } }
CMD:guardararma1(playerid, response, listitem, params[]) { if(response){ new weap, ammo; new string[128]; GetPlayerWeaponData(playerid, listitem + 1, weap, ammo); ArmasGuardadas[playerid][Selected[playerid][2]] = weap; BalasGuardadas[playerid][Selected[playerid][2]] = ammo; format(string, sizeof string, "Vocк guardou uma arma %s com %d balas no slot: %d. Para pegar use: /mochila", NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]]),BalasGuardadas[playerid][Selected[playerid][2]], Selected[playerid][2]); SendClientMessage(playerid, COLOR_R, string); RemovePlayerWeapon(playerid, weap); format(string, sizeof(string), "* %s guardou um(a) %s em sua mochila", NomePlayer(playerid), NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]])); SendClientMessageInRange(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE); SetPVarInt(playerid, "guardando", 0); HideMochila(playerid); } }
new SlotReal; SlotReal = GetPVarInt(playerid, "AttachmentIndexSel"); if(InvCheio[playerid] == 1) { InvCheio[playerid] = 0; return 1; } itemnamochila(playerid,ObjectLoad[playerid][SlotReal][Objmodelid])
BPS::RemovePlayerAttachedObjectEx(playerid,SlotReal) { if(ItemSlotA[playerid][SlotReal] != -1) { if(ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Aureola1 && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Aureola2 && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Celular && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Roubo && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Radio && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Pa && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Maconha && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Escudo && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Planta && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Corrente && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Ejetar && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Ejetar2 && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Escudo && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Colete && ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] != Vaga_Taser) { if(IsAItem(playerid,SlotDItem[playerid][ItemSlotA[playerid][SlotReal]],0)) { if(TipoItem[playerid] != 0) { itemnamochila(playerid,SlotDItem[playerid][ItemSlotA[playerid][SlotReal]]); } } } RemovePlayerAttachedObject(playerid, ItemSlotA[playerid][SlotReal]); ItemSlotP[playerid][ItemSlotA[playerid][SlotReal]] = -1; SlotDItem[playerid][ItemSlotA[playerid][SlotReal]] = -1; ObjectLoad[playerid][ItemSlotA[playerid][SlotReal]][Objindexid2] = 0; ItemSlotA[playerid][SlotReal] = -1; } }
for(new x = 1; x != 13; x++){
dialogArmas(playerid){ if(!countWeapons(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*Vocк nгo tem uma arma com vocк."), CancelSelectTextDraw(playerid),SelectTextDraw(playerid, 0xAAAAAAFF); new Str[95], weap, ammo; MEGAString[0] = EOS; for(new x = 1; x != 13; x++){ GetPlayerWeaponData(playerid, x, weap, ammo); if(weap && ammo){ format(Str, 95, "{FFFFFF}Arma: {A0A0A0}%s {FFFFFF}Balas: {A0A0A0}%03d\n", GunNames[weap], ammo); strcat(MEGAString, Str); }else{ strcat(MEGAString, "{FFFFFF}Arma: {A0A0A0}-------- {FFFFFF}Balas: {A0A0A0}---\n"); } } ShowPlayerDialog(playerid, 306, DIALOG_STYLE_LIST, "Escolha a arma para guardar", MEGAString, "Guardar", "Sair"); return 1; }
Selected[playerid][2]
PlayerTextDrawShow(playerid, moMsg[playerid]); PlayerTextDrawSetPreviewModel(playerid, moEquipPrev[playerid], 5699); PlayerTextDrawShow(playerid, moEquipPrev[playerid]); PlayerTextDrawShow(playerid, moArma[playerid]); PlayerTextDrawShow(playerid, moBalas[playerid]); PlayerTextDrawShow(playerid, moUse[playerid]); PlayerTextDrawShow(playerid, moUse1[playerid]); PlayerTextDrawShow(playerid, moUse2[playerid]); PlayerTextDrawShow(playerid, moUse3[playerid]); //PlayerTextDrawShow(playerid, moUseBox[playerid]); PlayerTextDrawShow(playerid, moExit[playerid]); //PlayerTextDrawShow(playerid, moExit1[playerid]); //PlayerTextDrawShow(playerid, moInfo[playerid]); //PlayerTextDrawShow(playerid, moInfoBox[playerid]); PlayerTextDrawShow(playerid, moHelp[playerid]); PlayerTextDrawShow(playerid, moCr[playerid]); Selected[playerid][0] = 0; Selected[playerid][1] = 0; Selected[playerid][2] = 0; setweaponNome(playerid, Selected[playerid][0], Selected[playerid][1]); SelectTextDraw(playerid, 0xAAAAAAFF); SetPVarInt(playerid, "vMochila", 1); }
ublic OnPlayerClickPlayerTextDraw(playerid, PlayerText:playertextid) { if(GetPVarInt(playerid, "vMochila")){ for(new x = 1; x <= 12; x++){ if(playertextid == moPrev[playerid][x]) { if(Inventario[playerid] == 2) x = x+12; if(Inventario[playerid] == 3) x = x+24; if(Inventario[playerid] == 4) x = x+36; if(x != MAX_ITEMS) { if(ArmasGuardadas[playerid][x] < 1 && ItemID[playerid][x] == 0){ //dialogGuardar(playerid); Selected[playerid][0] = 0; Selected[playerid][1] = 0; Selected[playerid][2] = x; setweaponNome(playerid, Selected[playerid][0], Selected[playerid][1]); ///SendClientMessage(playerid, COLOR_LIGHTRED, "* Nгo tem uma arma nesse slot!"); PlayerPlaySound(playerid, 1085, 0.0, 0.0, 0.0); return 1; }
else { PlayerTextDrawSetPreviewRot(playerid, moEquipPrev[playerid], 180.000000, 160.000000, 360.000000, 2.099999); PlayerTextDrawSetPreviewModel(playerid, moEquipPrev[playerid], getidxModelSlot(playerid, x)); PlayerTextDrawShow(playerid, moEquipPrev[playerid]); Selected[playerid][0] = ArmasGuardadas[playerid][x]; if(IsAItem(playerid,Selected[playerid][0],0)) { Selected[playerid][0] = ArmasGuardadas[playerid][x]; Selected[playerid][1] = BalasGuardadas[playerid][x]; Selected[playerid][2] = x; } setweaponNome(playerid, Selected[playerid][0], Selected[playerid][1]); PlayerPlaySound(playerid, 1083, 0.0, 0.0, 0.0); return 1; } } } }
dialogArmas(playerid){ if(!countWeapons(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*Vocк nгo tem uma arma com vocк."), CancelSelectTextDraw(playerid),SelectTextDraw(playerid, 0xAAAAAAFF); new Str[95], weap, ammo; MEGAString[0] = EOS; for(new x = 1; x != 13; x++){ GetPlayerWeaponData(playerid, x, weap, ammo); if(weap && ammo){ format(Str, 95, "{FFFFFF}Arma: {A0A0A0}%s {FFFFFF}Balas: {A0A0A0}%03d\n", GunNames[weap], ammo); strcat(MEGAString, Str); }else{ strcat(MEGAString, "{FFFFFF}Arma: {A0A0A0}-------- {FFFFFF}Balas: {A0A0A0}---\n"); } } ShowPlayerDialog(playerid, 306, DIALOG_STYLE_LIST, "Escolha a arma para guardar", MEGAString, "Guardar", "Sair"); return 1; }
GetSlotFree(playerid)
{
for(new i = 0; i <= 10; i++)
if(Selected[playerid][i] == 0) return i;
return -1;
}
new value = GetSlotFree(playerid);
if(value != -1)
{
ArmasGuardadas[playerid][Selected[playerid][value]] = weap;
BalasGuardadas[playerid][Selected[playerid][value]] = ammo;
} else SendClientMessage(playerid,-1,"ERRO: slots cheios");
Bem mano sinceramente este seu sistema ta uma zona. Eu fiz uma funзгo para seu problema,nгo sei se vai funcionar pois nгo conheзo como este sistema realmente funciona.
Cуdigo: PHP Code:
PHP Code:
Ex: new Selected[playerid][20] vocк troca por i <= 20. |
GetSlotFree(playerid) { for(new i = 0; i <= 10; i++) if(Selected[playerid][i] == 0) return i; return -1; } CMD:guardararma(playerid, response, listitem, params[]) { // SelectTextDraw(playerid, 0xAAAAAAFF); new value = GetSlotFree(playerid); if(value != -1) { ArmasGuardadas[playerid][Selected[playerid][value]] = weap; BalasGuardadas[playerid][Selected[playerid][value]] = ammo; } else SendClientMessage(playerid,-1,"ERRO: slots cheios"); if(response){ new weap, ammo; new string[128]; if(ammo < 1) return CancelSelectTextDraw(playerid), SendClientMessage(playerid, COLOR_YELLOW, ""), dialogArmas(playerid); ArmasGuardadas[playerid][Selected[playerid][2]] = weap; BalasGuardadas[playerid][Selected[playerid][2]] = ammo; format(string, sizeof string, "Vocк guardou uma arma %s com %d balas no slot: %d. Para pegar use: /mochila", NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]]),BalasGuardadas[playerid][Selected[playerid][2]], Selected[playerid][2]); SendClientMessage(playerid, COLOR_R, string); RemovePlayerWeapon(playerid, weap); SetPVarInt(playerid, "guardando", 0); HideMochila(playerid); } else{ SetPVarInt(playerid, "guardando", 0); } }
CMD:guardararma(playerid, response, listitem, params[])
{
if(response)
{
new value = GetSlotFree(playerid);
new weap, ammo;
new string[128];
if(ammo < 1)
return CancelSelectTextDraw(playerid), SendClientMessage(playerid, COLOR_YELLOW, ""), dialogArmas(playerid);
if(value != -1)
{
ArmasGuardadas[playerid][Selected[playerid][value]] = weap;
BalasGuardadas[playerid][Selected[playerid][value]] = ammo;
} else return SendClientMessage(playerid,-1,"ERRO: slots cheios");
format(string, sizeof string, "Vocк guardou uma arma %s com %d balas no slot: %d. Para pegar use: /mochila", NomeItemID(ArmasGuardadas[playerid][Selected[playerid][2]]),BalasGuardadas[playerid][Selected[playerid][2]], Selected[playerid][2]);
SendClientMessage(playerid, COLOR_R, string);
RemovePlayerWeapon(playerid, weap);
SetPVarInt(playerid, "guardando", 0);
HideMochila(playerid);
}
else
SetPVarInt(playerid, "guardando", 0);
}
Estб errado.
PHP Code:
|
Estб errado.
PHP Code:
|
if(!countWeapons(playerid)) return SendClientMessage(playerid, COLOR_YELLOW, "*Vocк nгo tem uma arma com vocк."), CancelSelectTextDraw(playerid),SelectTextDraw(playerid, 0xAAAAAAFF); new Str[95], weap, ammo; MEGAString[0] = EOS; for(new x = 1; x != 13; x++){ GetPlayerWeaponData(playerid, x, weap, ammo); if(weap && ammo){ format(Str, 95, "{FFFFFF}Arma: {A0A0A0}%s {FFFFFF}Balas: {A0A0A0}%03d\n", GunNames[weap], ammo); strcat(MEGAString, Str); }else{ strcat(MEGAString, "{FFFFFF}Arma: {A0A0A0}-------- {FFFFFF}Balas: {A0A0A0}---\n"); } }