Is this possible?
#8

I didn't really understand.

A dialog is unique by definition : when a player shows a dialog, you act on a "playerid" var, and playerid is the id of each player who shows the dialog.

So a code like that

PHP код:

new cp[MAX_PLAYERS];
CMD:sellguns(playeridparams[])
{
      
cp[playerid] = CreateDynamicCP(params);
      return 
1;
}
public 
OnPlayerEnterDynamicCP(playeridcheckpointid)
{
      foreach(new 
Player)
      {
            if(
cp[p] == checkpointid)
            {
                  
SetPVarInt(playerid"WeaponSeller"p);
                  return 
ShowPlayerDialog(playeridDIALOG_WEAPONSDIALOG_STYLE_LIST"Buying weapons""M4\nAk-47\n""Buy""Close");
            }
      }
      return 
1;
}
public 
OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
      if(
dialogid == DIALOG_WEAPONS)
      {
            if(!
response) return 1;
            if(
listitem == 0)
            {
                  
GivePlayerWeapon(playerid31999);
                  
GivePlayerMoney(playerid, -price_of_the_m4);
                  
GivePlayerMoney(GetPVarInt(playerid"WeaponSeller"), price_of_the_m4);
                  return 
1;
            }
            else if(
listitem == 1)
            {
                  
GivePlayerWeapon(playerid30999);
                  
GivePlayerMoney(playerid, -price_ak_47);
                  
GivePlayerMoney(GetPVarInt(playerid"WeaponSeller"), price_ak_k7);
                  return 
1;
            }
      }
      return 
0;
}
public 
OnPlayerExitDynamicCP(playeridcheckpointid)
{
      foreach(new 
Players)
      {
            if(
checkpointid == cp[p]) DeletePVar(playerid"WeaponSeller");
      }

Will work as a charm.
Reply


Messages In This Thread
Is this possible? - by rumen98 - 26.05.2014, 15:51
Re : Is this possible? - by S4t3K - 26.05.2014, 15:54
Re: Is this possible? - by XK - 26.05.2014, 15:56
Re: Is this possible? - by rumen98 - 26.05.2014, 15:59
Re: Is this possible? - by XK - 26.05.2014, 16:05
Re : Is this possible? - by S4t3K - 26.05.2014, 16:18
Re: Re : Is this possible? - by rumen98 - 26.05.2014, 16:21
Re : Is this possible? - by S4t3K - 26.05.2014, 16:33

Forum Jump:


Users browsing this thread: 3 Guest(s)