13.11.2016, 15:33
Hello Guys I just add a equip system with dialog.
So the problem that when i type /equip and then press on S.W.A.T to take guns nothing happen
Here is the SS:
Here is the code.
So the problem that when i type /equip and then press on S.W.A.T to take guns nothing happen
Here is the SS:
Here is the code.
pawn Код:
new EquipSlots[][EEquipInfo] = { //So difficult to read....
//lspd
{"Patrol Officer",1,1,24,25,29,0,41,3,0,0,0,0,0,0},
{"Detective",1,5,43,24,0,0,0,0,0,0,0,0,0},
{"Sergeant",1,6,24,25,29,41,3,0,0,0,0,0,0},
{"Lieutenant",1,10,24,25,29,33,41,3,0,0,0,0,0},
{"Captain/Chief",1,12,24,25,29,33,41,3,31,0,0,0,0},
//SWAT - Makes part of LSPD - Rank starting from 3
{"S.W.A.T. Special",1,3,24,0,0,0,0,3,31,0,0,0,0,0},
{"S.W.A.T. Tactical",1,3,24,0,29,0,0,3,0,0,0,0,0,0},
{"S.W.A.T. Sniper",1,3,23,0,0,34,0,3,0,0,0,0,0},
//fbi
//{"Staff",2,1,41,3,24,25,29,0,0,0,0,0,0,0},
//{"Equipment",2,0,46,43,42,41,3,0,0,0,0,0,0,0},
{"Probationary",2,1,41,3,24,25,0,0,0,0,0,0,0,0},
{"Intern",2,2,41,3,24,25,29,0,0,0,0,0,0,0},
{"Staff",2,3,41,3,24,25,29,31,0,0,0,0,0,0},
{"Agent",2,4,41,3,24,29,30,31,34,0,0,0,0,0},
{"Senior Agent",2,5,41,3,24,28,32,29,30,31,34,0,0,0},
{"Special Agent",2,5,41,3,24,28,32,29,30,31,34,0,0,0},
{"Deputy Director",2,5,41,3,24,28,32,29,30,31,34,0,0,0},
{"Director",2,5,41,24,32,28,29,30,31,34,0,0,0,0},
//mayor
{"Overwatch",3,10,34,0,43,3,0,0,0,0,0,0,0,0},
{"Guard Duty",3,10,24,0,41,3,0,0,0,0,0,0,0,0},
{"Agent Duty",3,10,23,0,43,3,0,0,0,0,0,0,0,0},
{"Mayor",3,0,0,0,0,0,0,0,0,0,0,0,0,0},
//EMS/FF
{"Trainee",5,1,0,0,0,0,0,0,0,0,0,15,0,0},
{"Probationary",5,2,0,0,0,0,0,0,0,0,0,15,0,0},
{"FF/EMT-B",5,3,6,0,0,0,0,0,0,0,42,15,0,0},
{"FF/EMT-I",5,4,6,0,0,0,0,0,0,0,42,15,0,0},
{"FF/EMT-A",5,5,6,0,0,0,0,0,0,0,42,15,0,0},
{"Lieutenant",5,6,6,0,0,0,0,0,0,0,42,15,0,0},
{"Captain",5,7,6,0,0,0,0,0,0,0,42,15,0,0},
{"Battalion Commander",5,8,6,0,0,0,0,0,0,0,42,15,0,0},
{"Battalion Chief",5,9,6,0,0,0,0,0,0,0,42,15,0,0},
{"Deputy Fire Chief",5,10,6,0,0,0,0,0,0,0,42,15,0,0},
{"Fire Chief",5,11,6,0,0,0,0,0,0,0,42,15,0,0},
//CA Dept of Corrections
{"Police Officer",8,1,22,25,3,0,0,0,0,0,0,0,0,0},
{"Field Training Officer",8,2,24,25,3,41,0,0,0,0,0,0,0},
{"Sergeant",8,3,24,25,29,41,3,0,0,0,0,0,0},
{"Lieutenant",8,4,24,25,29,33,41,3,0,0,0,0,0},
{"Captain",8,5,24,25,29,33,41,3,31,0,0,0,0},
{"Inspector",8,6,24,25,29,33,41,3,31,0,0,0,0},
{"Deputy Chief",7,11,24,25,29,33,41,3,31,0,0,0,0},
{"Chief",8,8,24,25,29,33,41,3,31,0,0,0,0}
};
showEquipMenu(playerid) {
new temptxt[256];
dialogstr[0] = 0;
new faction = GetPVarInt(playerid, "Faction");
new rank = GetPVarInt(playerid, "Rank");
for(new i=0;i<sizeof(EquipSlots);i++) {
if(faction == EquipSlots[i][EEquipFaction]) {
if(rank >= EquipSlots[i][EEquipMinRank]) {
format(temptxt, sizeof(temptxt), "%s\n",EquipSlots[i][EEquipName]);
strcat(dialogstr,temptxt,sizeof(dialogstr));
}
}
}
ShowPlayerDialog(playerid, EFactionDialog_EquipChoose, DIALOG_STYLE_LIST, "{00BFFF}Equip Menu",dialogstr, "Ok", "Cancel");
}
getEquipListedAt(playerid, index){
new faction = GetPVarInt(playerid, "Faction");
new rank = GetPVarInt(playerid, "Rank");
new x;
for(new i=0;i<sizeof(EquipSlots);i++){
if(faction == EquipSlots[i][EEquipFaction]) {
if(rank >= EquipSlots[i][EEquipMinRank]) {
if(x++ == index)
return i;
}
}
}
return -1;
}