18.10.2016, 16:19
Dialog does not working. Here is the code:
Show Player Dialog:
Dialog Response of Equip
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}
};
pawn Код:
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");
}
pawn Код:
onEquipResponse(playerid, index) {
new slot = getEquipListedAt(playerid, index);
new msg[128];
if(GetPVarType(playerid, "CopDuty") == PLAYER_VARTYPE_NONE && !isOnMedicDuty(playerid)) {
return 1;
}
if(GetPVarInt(playerid, "Rank") < EquipSlots[slot][EEquipMinRank]) {
return 1;
}
ResetPlayerWeaponsEx(playerid);
if(EquipSlots[slot][EEquipGun1] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun1], -1);
}
if(EquipSlots[slot][EEquipGun2] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun2], -1);
}
if(EquipSlots[slot][EEquipGun3] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun3], -1);
}
if(EquipSlots[slot][EEquipGun4] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun4], -1);
}
if(EquipSlots[slot][EEquipGun5] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun5], -1);
}
if(EquipSlots[slot][EEquipGun6] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun6], -1);
}
if(EquipSlots[slot][EEquipGun7] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun7], -1);
}
if(EquipSlots[slot][EEquipGun8] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun8], -1);
}
if(EquipSlots[slot][EEquipGun9] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun9], -1);
}
if(EquipSlots[slot][EEquipGun10] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun10], -1);
}
if(EquipSlots[slot][EEquipGun11] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun11], -1);
}
if(EquipSlots[slot][EEquipGun12] != 0) {
GivePlayerWeaponEx(playerid, EquipSlots[slot][EEquipGun12], -1);
}
SetPlayerHealthEx(playerid, 100.0);
SetPlayerArmourEx(playerid, 100.0);
format(msg, sizeof(msg), "* %s has suited %sself up with %s equipment.",GetPlayerNameEx(playerid, ENameType_RPName), getThirdPersonPersonalPronoun(playerid),EquipSlots[slot][EEquipName]);
ProxMessage(30.0, playerid, msg, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
return 0;
}