SA-MP Forums Archive
Problem with OnPlayerPickUpDynamicPickup - 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: Problem with OnPlayerPickUpDynamicPickup (/showthread.php?tid=640813)



Problem with OnPlayerPickUpDynamicPickup - None1337 - 07.09.2017

I have a problem with OnPlayerPickUpDynamicPickup

When a player is in a Dynamic PickUp, its show this message

Код:
PlayerTextDrawShow(playerid, td1[playerid]);
		PlayerTextDrawSetString(playerid, td1[playerid], "Here you can type /exam to start.");
The problem is, when he leave the pickup the textdraw doesn't disappear, how can i fix?

Same with OnPlayerPickUpPickup.


Re: Problem with OnPlayerPickUpDynamicPickup - MP2 - 08.09.2017

I wrote an include for this very problem.

https://pastebin.com/BCkeqTmd

It uses the SA-MP pickup system however, not the streamer. You just need to change the functions and callbacks to the streamer ones.

Example code:
pawn Код:
new myPickup;

public OnGameModeInit()
{
    myPickup = ELP_CreatePickup(...);
    return 1;
}

public OnEnterLeavePickup(playerid, pickupid, enterleave)
{
    if(pickupid == myPickup)
    {
        if(enterleave)
        {
            // Player entered pickup - show textdraw
        }
        else
        {
            // Player left pickup - destroy textdraw
        }
    }
    return 1;
}