enter / exit in dialogs -
CH | FuDo - 04.08.2012
Hi guys, it's me again :P
I would like to make enter / exit on dialog. When player pickup the pickup, it need to show him a dialog in message box, and if he choose "Yes" it's need to port him on appropriate location. So, any suggestions how to do that ? Thanks anyway.
Re: enter / exit in dialogs -
Ranama - 04.08.2012
Use OnPlayerPickUpPickup(pickupid, playerid)//don't realy know if it's like this but something like this
then you'll have to create a TextDraw, like this
https://sampwiki.blast.hk/wiki/TextDrawCreate
and when a player PickUpPickup you'll show the TextDraw for that player.
Hope you understand something
Or if you wanted to have a dialog you'll have to ShowPlayerDialog instead of ShowPlayerText etc
Re: enter / exit in dialogs -
Sascha - 04.08.2012
use a player variable like: "InPickup[playerid]"
and define it at the top of your script (like this):
pawn Код:
new InPickup[MAX_PLAYERS];
pawn Код:
public OnPlayerConnect(playerid)
{
InPickup[playerid] = 0;
}
then change the variable when the player enters the pickup
pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
if(pickupid == yourpickup)
{
if(InPickup[playerid] == 0)
{
ShowPlayerDialog(playerid, X, DIALOG_STYLE_MSGBOX, "Heading", "blablabla", "Yes", "No");
InPickup[playerid] = 1;
}
}
return 1;
}
(change the "X" ofc)
then for your dialog thingy, set a timer to set the variable back to 0.. like this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == X)
{
SetTimerEx("ChangeBack", 3000, false, "i", playerid);
if(response == 0) return 1;
else
{
//Teleport Player
}
}
return 1;
}
and finally the callback for the timer:
pawn Код:
forward ChangeBack(playerid);
public ChangeBack(playerid)
{
InPickup[playerid] = 0;
return 1;
}
this is a rough version ofc