SA-MP Forums Archive
dialog response to every pickup! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: dialog response to every pickup! (/showthread.php?tid=465409)



dialog response to every pickup! - zrelly - 22.09.2013

Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{

    {
    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5500$\n\nWeapons\nDeathmatch stadium\nRunnies Deathmatch", "Select", "Cancel");
    }
	return 1;
}

stock ShowDialog(playerid)
{
      ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5500$\n\nWeapons\nDeathmatch stadium\nRunnies Deathmatch", "Select", "Cancel");
return 1;
}

	
	//Briefcases Aka Weapon Shopes

	 CreatePickup(1210,2,-148.4453,1110.0249,19.7500, -1);
	 CreatePickup(1210, 2, -297.04, 1537.17, 75.56);
	 CreatePickup(1210, 2, 284.25, 1923.62, 17.64);
	 CreatePickup(1210,2,-797.5327,1556.2026,27.1244, -1);
	 CreatePickup(1210,2,1146.6642,1976.5652,10.8203, -1);
     CreatePickup(1210, 2, -1463.82, 2613.76, 62.06);
	 CreatePickup(1210,2,-252.4021,2603.1230,62.8582, -1); //usa pickup
how to fix it? whenever i go to a weapon pickup,money bag pickup etc it shows me the dialog..


Re: dialog response to every pickup! - TunisianoGamer - 22.09.2013

Try this Plan
Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(IsPlayerInRangeOfPoint(playerid,5.0,-148.4453,1110.0249,19.7500))
		{
                    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_LIST, "Briefcase", "Health - 5000$\nArmour - 5500$\n\nWeapons\nDeathmatch stadium\nRunnies Deathmatch", "Select", "Cancel");
		    return 1;
		}

else if(IsPlayerInRangeOfPoint(playerid,5.0,-797.5327,1556.2026,27.1244))
               {
                    //Dialog
		    return 1;
		}
else if(IsPlayerInRangeOfPoint(playerid,5.0,1146.6642,1976.5652,10.8203))
               {
                    // another Dialog
		    return 1;
		}
	return 1;
}



Re: dialog response to every pickup! - Konstantinos - 22.09.2013

@TunisianoGamer; Whenever they close the dialog, they pickup again the pickup and they are in range - thus it will show the dialog again.

pawn Код:
// Global variable
new
    bool: In_Pickup[ MAX_PLAYERS ]
;

// OnPlayerConnect:
In_Pickup[ playerid ] = false;

public OnPlayerPickUpPickup( playerid, pickupid )
{
    switch( pickupid )
    {
        case YOU_PICKUP_THAT_SHOWS_THE_DIALOG:
        {
            if( IsPlayerInRangeOfPoint( playerid, 1.0, X, Y, Z ) ) // CHANGE THE COORDINATES
            {
                if( !In_Pickup[ playerid ] )
                {
                    In_Pickup[ playerid ] = true;
                    ShowPlayerDialog( ... );
                }
            }
            else
            {
                if( In_Pickup[ playerid ] ) In_Pickup[ playerid ] = false;
            }
        }
    }
    return 1;
}