Different dialog options for different factions
#1

Hey, I'd like to add different dialog options for different factions in a RP gamemode I am editing.

Код:
					{
					    format(szTitle, sizeof(szTitle), "%s Locker Menu", arrGroupData[iGroupID][g_szGroupName]);
					    if(arrGroupData[iGroupID][g_iLockerCostType] == 0) {
					        if(arrGroupData[iGroupID][g_iLockerStock] > 100)
					        {
					        	format(szTitle, sizeof(szTitle), "%s - Locker Stock: %d", szTitle, arrGroupData[iGroupID][g_iLockerStock]);
							}
							else
							{
							    format(szTitle, sizeof(szTitle), "%s - {AA3333}Locker Stock: %d", szTitle, arrGroupData[iGroupID][g_iLockerStock]);
							}
					    }
					    format(szDialog, sizeof(szDialog), "Duty\nEquipment\nUniform\nFirstAid & Kevlar%s", (arrGroupData[iGroupID][g_iGroupType] == 1) ? ("\nClear Suspect\nMedkit & Vest Trunk Kit\nTazer & Cuffs\n") : (arrGroupData[iGroupID][g_iGroupType] == 2) ? ("\nKnife\n") : (""));
						ShowPlayerDialog(playerid, G_LOCKER_MAIN, DIALOG_STYLE_LIST, szTitle, szDialog, "Select", "Cancel");
						return 1;
					}
So basically, the options Duty, Equipment, Uniform and FirstAid & Kevlar should be available for every faction, options Clear Suspect, Medkit & Vest Trunk Kit and Tazer for GroupType 1 which would be the Law Enforcement Agency, whereas the Knife should be available only for GroupType 2, which is the Contract Agency.

So basically, the menu itself works fine for Contract Agency, but instead of getting the Knife, I get the option to perform 'Clear Suspect'. I also added Knife to be the case 7 in the list, but it doesn't really seem to matter.
Reply
#2

It's because it's not case 7 and it's case 4, you should check the playerid's faction under case 4, enter clear suspects if LEO factions and give them knife if they have Contract faction.
Reply
#3

Quote:
Originally Posted by PrO.GameR
Посмотреть сообщение
It's because it's not case 7 and it's case 4, you should check the playerid's faction under case 4, enter clear suspects if LEO factions and give them knife if they have Contract faction.
Did this, but it gives me errors.

PHP код:
                case 4:
                {
                    if (
arrGroupData[iGroupID][g_iGroupType] == 1
                    {
                        
ShowPlayerDialog(playeridG_LOCKER_CLEARSUSPECT,DIALOG_STYLE_INPUTarrGroupData[iGroupID][g_szGroupName]," Who would you like to clear?","Clear","Return");
                    }
                
                    else if (
arrGroupData[iGroupID][g_iGroupType] == 2)
                    {
                    if(
PlayerInfo[playerid][pHasKnife] == 0)
                    {
                        
SendClientMessageEx(playeridCOLOR_WHITE"You are now carrying a knife.");
                        
PlayerInfo[playerid][pHasKnife] = 1;
                    }
                    else return 
SendClientMessageEx(playeridCOLOR_WHITE"You are already carrying a knife.");
                    }
                    
                } 
Код:
./includes/commands.pwn(55676) : warning 204: symbol is assigned a value that is never used: "string"
./includes/OnDialogResponse.pwn(391) : warning 217: loose indentation
./includes/OnDialogResponse.pwn(391) : error 014: invalid statement; not in switch
./includes/OnDialogResponse.pwn(391) : warning 215: expression has no effect
./includes/OnDialogResponse.pwn(391) : error 001: expected token: ";", but found ":"
./includes/OnDialogResponse.pwn(391) : error 029: invalid expression, assumed zero
./includes/OnDialogResponse.pwn(391) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

for the first error delete the varieble for "string" cause you are not using it.

secondly you need to show which line is 391 we cant tell
Reply
#5

Got it working, thanks for your help people.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)