View Single Post
Old 06/07/2019, 06:20 PM   #17
Plastikmensch
Huge Clucker
 
Join Date: Aug 2016
Posts: 272
Reputation: 22
Default Re: How to give weapons after they choosed?

You have to save the listitem in the first dialog in a global (or local in OnDialogResponse) variable.
listitem >= 0 is unnecessary, because it will always be 0 or greater.
Code:
new selectedWeapon[MAX_PLAYERS];
if(dialogid==DIALOG_WEAPONS)
{
   if(response)
   {
      selectedWeapon[playerid]=listitem;
      //Your code
   }
}
if(dialogid == DIALOG_WEAPONS2)
{
   if(response)
   {
      GivePlayerWeapon(playerid, weaponArray[selectedWeapon[playerid]][wID],weaponArray[selectedWeapon[playerid]][wAmmo]);
      GivePlayerWeapon(playerid, weaponArray2[listitem][wID],weaponArray2[listitem][wAmmo]);
   }
}
Plastikmensch is offline   Reply With Quote