View Single Post
Old 06/07/2019, 02:50 AM   #13
SiaReyes
Gangsta
 
SiaReyes's Avatar
 
Join Date: Mar 2019
Location: Coordinates X,Y,Z
Posts: 623
Reputation: 57
Default Re: How to give weapons after they choosed?

Quote:
Originally Posted by Edvukas View Post
How can I save player's options and then give him weapons which he choosed?
I'll just give an example

pawn Code:
new SelectedWeapon[MAX_PLAYERS] = 0; // Put this on top

public OnPlayerConnect(playerid)
{

  SelectedWeapon[playerid] =0; // reset
   return 1;
}

// Under OnDialogResponse
   if(dialogid == Weapons)
  {
        if(!response) return true;
        if(response)
        {
                   SelectedWeapon[playerid] = listitem+1; // is case 0 , it will be 0+1 = 1, so take 1 as eagle and 2 as some other weapon id
          }    
    }                        
 

// Function to give player selected weapons
stock GivePlayerSelectedWeapon(playerid)
{
       if(SelectedWeapon[playerid] == 0) return true; // it's not needed but just a simple check
        switch(SelectedWeapon[playerid])
        {
                 case 1 :  GivePlayerWeapon(playerid, 24, 500);  // deagle
                 case 2 : GivePlayerWeapon(playerid, 25, 500); // some other weapon
         }
}
SiaReyes is offline   Reply With Quote